/* DocBeauty & Dentalreise – Adminpanel */
:root {
  --bg:        #f4f6fa;
  --surface:   #ffffff;
  --line:      #e3e8f0;
  --text:      #16202f;
  --muted:     #64748b;
  --accent:    #6d4aff;
  --accent-dk: #5636e0;
  --sidebar:   #141b2d;
  --sidebar-2: #1d2740;
  --ok:        #16a34a;
  --warn:      #d97706;
  --err:       #dc2626;
  --radius:    12px;
  --shadow:    0 1px 2px rgba(16,24,40,.05), 0 8px 24px -12px rgba(16,24,40,.18);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }

/* ---------- Layout ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 236px; flex: 0 0 236px;
  background: var(--sidebar);
  color: #c7d0e4;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand strong { display: block; color: #fff; font-size: 15px; }
.sidebar-brand small { color: #8f9dba; font-size: 11.5px; }
.logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #7c5cff, #b46bff);
  color: #fff; font-weight: 700; font-size: 14px;
  display: grid; place-items: center;
}

.sidebar-nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.sidebar-nav a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 12px; margin-bottom: 2px;
  border-radius: 8px; color: #c7d0e4; font-weight: 500;
}
.sidebar-nav a:hover { background: var(--sidebar-2); color: #fff; text-decoration: none; }
.sidebar-nav a.active { background: var(--accent); color: #fff; }
.nav-count {
  font-style: normal; font-size: 11px; font-weight: 700;
  background: rgba(255,255,255,.16); color: #fff;
  padding: 1px 7px; border-radius: 999px;
}
.sidebar-nav a.active .nav-count { background: rgba(0,0,0,.25); }

.sidebar-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-foot .who { flex: 1; min-width: 0; }
.sidebar-foot strong { display: block; color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot small { color: #8f9dba; font-size: 11px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--sidebar-2); color: #fff;
  display: grid; place-items: center; font-size: 12px; font-weight: 600;
}
.logout { color: #8f9dba; font-size: 16px; }
.logout:hover { color: #fff; text-decoration: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 26px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.subtitle { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.quicksearch input {
  width: 240px; padding: 8px 12px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--bg); font-size: 13.5px;
}
.quicksearch input:focus { outline: 2px solid var(--accent); outline-offset: -1px; background: #fff; }

.content { padding: 22px 26px; flex: 1; }
.pagefoot { padding: 14px 26px 24px; color: var(--muted); font-size: 12px; }

/* ---------- Karten ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.card-head .sub { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1400px) { .grid-5 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1100px) { .grid-4, .grid-5 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px)  { .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; } }

/* ---------- KPI ---------- */
.kpi {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
  display: block; color: inherit;
}
a.kpi:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); transition: .12s; }
.kpi .kpi-label { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.kpi .kpi-value { font-size: 27px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; }
.kpi .kpi-note { color: var(--muted); font-size: 12px; margin-top: 2px; }
.kpi.alert { border-left: 3px solid var(--err); }
.kpi.warn  { border-left: 3px solid var(--warn); }
.kpi.good  { border-left: 3px solid var(--ok); }
.kpi.info  { border-left: 3px solid var(--accent); }

/* ---------- Tabellen ---------- */
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 700; padding: 10px 14px;
  border-bottom: 1px solid var(--line); background: #fafbfd; white-space: nowrap;
}
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbff; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.nowrap, th.nowrap { white-space: nowrap; }
.t-main { font-weight: 600; }
.t-sub { color: var(--muted); font-size: 12.5px; }
.empty { padding: 34px 18px; text-align: center; color: var(--muted); }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 650; white-space: nowrap; line-height: 1.5;
}
.badge-gray   { background: #eef1f6; color: #475569; }
.badge-blue   { background: #e0edff; color: #1d4ed8; }
.badge-violet { background: #ede6ff; color: #6d28d9; }
.badge-amber  { background: #fef3c7; color: #b45309; }
.badge-teal   { background: #ccfbf1; color: #0f766e; }
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-red    { background: #fee2e2; color: #b91c1c; }

.brand {
  display: inline-block; padding: 2px 8px; border-radius: 6px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
}
.brand-docbeauty   { background: #fce7f3; color: #be185d; }
.brand-dentalreise { background: #dbeafe; color: #1e40af; }
.brand-beide       { background: #ede9fe; color: #6d28d9; }

.due      { color: var(--err); font-weight: 650; }
.due-soon { color: var(--warn); font-weight: 650; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font-size: 13.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { background: #f8fafc; text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dk); }
.btn-danger { background: #fff; border-color: #fca5a5; color: var(--err); }
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-link { border: 0; background: none; color: var(--accent); padding: 0; }
.btn:disabled, .btn[disabled] {
  background: #e8ebf1; border-color: #dce1ea; color: #9aa4b6;
  cursor: not-allowed; opacity: 1;
}
.btn:disabled:hover, .btn[disabled]:hover { background: #e8ebf1; }

/* ---------- Formulare ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 760px) { .form-grid { grid-template-columns: 1fr; } }

label.field { display: block; }
label.field > span {
  display: block; font-size: 12.5px; font-weight: 650; color: var(--muted);
  margin-bottom: 5px;
}
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date],
input[type=password], input[type=search], input[type=url], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; font-size: 13.5px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { min-height: 90px; resize: vertical; }
input[type=file] { font-size: 13px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 4px; }

.form-actions {
  display: flex; gap: 10px; align-items: center;
  padding: 14px 18px; border-top: 1px solid var(--line); background: #fafbfd;
  border-radius: 0 0 var(--radius) var(--radius);
}
fieldset { border: 0; padding: 0; margin: 0 0 20px; }
fieldset > legend {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: 0 0 10px;
}

/* ---------- Filterleiste ---------- */
.filters {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  padding: 14px 18px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px;
}
.filters label.field { min-width: 150px; }
.filters .grow { flex: 1; min-width: 200px; }

/* ---------- Flash ---------- */
.flash { margin: 14px 26px -4px; padding: 11px 15px; border-radius: 9px; font-weight: 550; font-size: 13.5px; }
.flash-success { background: #dcfce7; color: #14532d; border: 1px solid #86efac; }
.flash-error   { background: #fee2e2; color: #7f1d1d; border: 1px solid #fca5a5; }
.flash-info    { background: #e0edff; color: #1e3a8a; border: 1px solid #93c5fd; }

/* ---------- Detailansicht ---------- */
.detail-grid { display: grid; grid-template-columns: minmax(0,2fr) minmax(280px,1fr); gap: 18px; align-items: start; }
@media (max-width: 1000px) { .detail-grid { grid-template-columns: 1fr; } }

dl.facts { margin: 0; display: grid; grid-template-columns: 140px 1fr; gap: 9px 14px; }
dl.facts dt { color: var(--muted); font-size: 12.5px; font-weight: 600; }
dl.facts dd { margin: 0; font-size: 13.5px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 11px 18px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.timeline li:last-child { border-bottom: 0; }
.timeline .meta { color: var(--muted); font-size: 12px; margin-top: 2px; }

.filelist { list-style: none; margin: 0; padding: 0; }
.filelist li { display: flex; align-items: center; gap: 11px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.filelist li:last-child { border-bottom: 0; }
.fileicon {
  width: 36px; height: 36px; border-radius: 8px; flex: 0 0 36px;
  background: #eef1f6; color: #475569; font-size: 10px; font-weight: 700;
  display: grid; place-items: center;
}
.filelist .fname { flex: 1; min-width: 0; }
.filelist .fname strong { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Fortschrittsbalken ---------- */
.bar { height: 7px; background: #eef1f6; border-radius: 999px; overflow: hidden; min-width: 70px; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* ---------- Login ---------- */
.login-page {
  min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(140deg, #141b2d, #2a1a52 60%, #4c2a6b);
  padding: 20px;
}
.login-box {
  width: 100%; max-width: 380px; background: #fff;
  border-radius: 16px; padding: 30px; box-shadow: 0 24px 60px -18px rgba(0,0,0,.5);
}
.login-box h1 { font-size: 20px; margin-bottom: 4px; }
.login-box p.lead { color: var(--muted); font-size: 13.5px; margin: 0 0 22px; }
.login-box label.field { margin-bottom: 14px; }
.login-box .btn { width: 100%; justify-content: center; padding: 11px; }
.login-error { background: #fee2e2; color: #7f1d1d; border: 1px solid #fca5a5; padding: 10px 13px; border-radius: 9px; font-size: 13px; margin-bottom: 16px; }

.pagination { display: flex; gap: 6px; align-items: center; padding: 12px 18px; color: var(--muted); font-size: 13px; }
.pagination a, .pagination span.cur {
  padding: 5px 10px; border-radius: 7px; border: 1px solid var(--line); background: #fff;
}
.pagination span.cur { background: var(--accent); color: #fff; border-color: var(--accent); }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs a { padding: 9px 14px; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; font-size: 13.5px; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
.tabs a:hover { text-decoration: none; color: var(--text); }

@media print {
  .sidebar, .topbar-actions, .filters, .form-actions, .btn { display: none !important; }
  .shell { display: block; }
  .card { box-shadow: none; }
}
