@import url('/vendor/open-sans/400.css');
@import url('/vendor/open-sans/600.css');
@import url('/vendor/open-sans/700.css');

/* Farben angelehnt an dialyse-walsrode.de */
:root {
  --green: #9fc01b;
  --green-dark: #89af16;
  --green-light: #f2f7e1;
  --blue: #2ea3f2;
  --blue-dark: #1b88d1;
  --blue-light: #e8f5fe;
  --red: #d32f2f;
  --gray: #999695;
  --text: #333333;
  --muted: #666666;
  --border: #e2e2e2;
  --bg: #f7f7f7;
  --panel: #ffffff;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  --radius: 4px;
  --header-h: 56px;
  --ribbon-h: 52px;
  font-family: 'Open Sans', Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body { line-height: 1.45; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-weight: 600; margin: 0 0 12px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: Consolas, monospace; }

/* ---------- Buttons & Formulare ---------- */
button, .btn {
  font: inherit; cursor: pointer; border: 1px solid var(--border); background: #fff; color: var(--text);
  padding: 7px 14px; border-radius: var(--radius); display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap; transition: background .15s, border-color .15s;
}
button:hover { background: #f1f1f1; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
button.primary:hover { background: var(--green-dark); }
button.blue { background: var(--blue); border-color: var(--blue); color: #fff; }
button.blue:hover { background: var(--blue-dark); }
button.danger { color: var(--red); border-color: #f0c4c4; }
button.danger:hover { background: #fdecec; }
button.ghost { border-color: transparent; background: transparent; }
button.ghost:hover { background: rgba(0, 0, 0, .06); }
button.icon { padding: 6px 9px; }
button.active { background: var(--blue-light); border-color: var(--blue); color: var(--blue-dark); }

input, select, textarea {
  font: inherit; color: inherit; border: 1px solid #cfcfcf; border-radius: var(--radius); padding: 7px 9px;
  background: #fff; width: 100%;
}
input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--blue); outline-offset: 0; border-color: var(--blue);
}
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--green); }
input[type=color] { padding: 2px; height: 34px; width: 52px; }
textarea { min-height: 80px; resize: vertical; }
label { display: block; font-weight: 600; font-size: 12.5px; margin-bottom: 4px; color: #444; }
.field { margin-bottom: 12px; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row > .field { flex: 1; min-width: 120px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 4px 0; cursor: pointer; }
.hint { font-size: 12px; color: var(--muted); margin-top: 3px; font-weight: 400; }
.error-box { background: #fdecec; color: var(--red); border: 1px solid #f0c4c4; padding: 8px 10px; border-radius: var(--radius); margin-bottom: 12px; }
.info-box { background: var(--blue-light); border: 1px solid #b9e0fb; padding: 10px 12px; border-radius: var(--radius); margin-bottom: 12px; }
.warn-box { background: #fff7e0; border: 1px solid #f3d98b; padding: 10px 12px; border-radius: var(--radius); margin-bottom: 12px; }

/* ---------- Kopfzeile ---------- */
.app-header {
  height: var(--header-h); background: #fff; border-bottom: 3px solid var(--green);
  display: flex; align-items: center; padding: 0 16px; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { height: 36px; max-width: 220px; object-fit: contain; }
.brand .name { font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand .sub { color: var(--gray); font-size: 12px; }
.header-search { flex: 1; max-width: 460px; margin-left: auto; position: relative; }
.header-search input { padding-left: 32px; background: var(--bg); }
.header-search::before { content: '⌕'; position: absolute; left: 10px; top: 5px; font-size: 18px; color: var(--gray); }
.user-menu { position: relative; }
.user-btn { border: none; background: transparent; gap: 8px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 13px;
}
.dropdown {
  position: absolute; right: 0; top: 44px; background: #fff; box-shadow: var(--shadow); border-radius: var(--radius);
  min-width: 220px; z-index: 50; padding: 6px 0; border: 1px solid var(--border);
}
.dropdown button { width: 100%; border: none; border-radius: 0; justify-content: flex-start; padding: 9px 16px; }

/* ---------- Layout ---------- */
.app { display: flex; height: calc(100vh - var(--header-h)); }
.nav-rail {
  width: 64px; background: #fff; border-right: 1px solid var(--border); display: flex; flex-direction: column;
  align-items: center; padding-top: 8px; gap: 4px;
}
.nav-rail button {
  flex-direction: column; gap: 2px; width: 56px; border: none; font-size: 10.5px; padding: 8px 2px; color: var(--muted);
}
.nav-rail button .ico { font-size: 20px; line-height: 1; }
.nav-rail button.active { background: var(--green-light); color: var(--green-dark); border-left: 3px solid var(--green); }
.main { flex: 1; display: flex; min-width: 0; }
.view { flex: 1; display: flex; min-width: 0; }

/* Kalender-Ansicht im Outlook-Stil */
.sidebar {
  width: 250px; background: #fff; border-right: 1px solid var(--border); overflow-y: auto; padding: 12px; flex-shrink: 0;
}
.sidebar .new-btn { width: 100%; justify-content: center; padding: 10px; font-size: 15px; margin-bottom: 6px; }
.sidebar h4 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 0 6px;
  display: flex; justify-content: space-between; align-items: center;
}
.cal-list label, .cat-list div { display: flex; align-items: center; gap: 8px; font-weight: 400; font-size: 13.5px; padding: 4px 2px; cursor: pointer; }
.swatch { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; display: inline-block; }
.cal-list input { margin: 0; }

.mini-cal { user-select: none; }
.mini-cal .head { display: flex; align-items: center; justify-content: space-between; font-weight: 600; margin-bottom: 4px; }
.mini-cal .head button { padding: 2px 8px; }
.mini-cal table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.mini-cal th { font-size: 11px; color: var(--gray); font-weight: 600; padding: 2px 0; }
.mini-cal td { text-align: center; font-size: 12px; padding: 0; }
.mini-cal td span { display: block; margin: 1px auto; width: 26px; line-height: 26px; border-radius: 50%; cursor: pointer; }
.mini-cal td span:hover { background: var(--bg); }
.mini-cal td.other span { color: #bbb; }
.mini-cal td.in-range span { background: var(--blue-light); }
.mini-cal td.today span { background: var(--green); color: #fff; font-weight: 700; }
.mini-cal td.kw { color: var(--gray); font-size: 10px; }

.cal-main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: #fff; }
.ribbon {
  min-height: var(--ribbon-h); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; flex-wrap: wrap; background: #fafafa;
}
.ribbon .title { font-size: 18px; font-weight: 600; margin: 0 10px; min-width: 200px; }
.ribbon .spacer { flex: 1; }
.btn-group { display: inline-flex; }
.btn-group button { border-radius: 0; margin-left: -1px; }
.btn-group button:first-child { border-radius: var(--radius) 0 0 var(--radius); margin-left: 0; }
.btn-group button:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
#calendar { flex: 1; min-height: 0; padding: 0 8px 8px; }

/* FullCalendar-Anpassungen */
.fc { --fc-border-color: #e6e6e6; --fc-today-bg-color: #f6faea; --fc-now-indicator-color: var(--red); font-size: 13px; }
.fc .fc-col-header-cell-cushion { color: var(--text); font-weight: 600; padding: 6px 4px; }
.fc .fc-daygrid-day-number { color: var(--text); }
.fc .fc-timegrid-slot { height: 2.2em; }
.fc .fc-timegrid-slot-label-cushion { color: var(--muted); font-size: 12px; }
.fc .fc-event { border-radius: 3px; border-width: 0 0 0 4px; cursor: pointer; }
.fc .fc-event.vacation { font-weight: 600; }
.fc .fc-event .recur-ico { opacity: .85; margin-left: 4px; }
.fc .fc-non-business { background: #fbfbfb; }
.fc .fc-list-event:hover td { background: var(--blue-light); }
.fc .fc-highlight { background: var(--blue-light); }

/* ---------- Panels (Einstellungen, Suche, Protokoll) ---------- */
.page { flex: 1; overflow-y: auto; padding: 20px 24px; }
.page-inner { max-width: 1150px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.tabs button { border: none; border-radius: 0; background: transparent; padding: 10px 14px; border-bottom: 3px solid transparent; margin-bottom: -2px; color: var(--muted); }
.tabs button.active { color: var(--text); border-bottom-color: var(--green); font-weight: 600; background: transparent; }
.toolbar { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar .field { margin-bottom: 0; }

table.grid { width: 100%; border-collapse: collapse; background: #fff; }
table.grid th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); border-bottom: 2px solid var(--border); padding: 8px; }
table.grid td { border-bottom: 1px solid #eee; padding: 8px; vertical-align: top; }
table.grid tr.clickable:hover td { background: var(--blue-light); cursor: pointer; }
table.grid tr.undone td { color: var(--gray); text-decoration: line-through; }
.badge { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 10px; background: #eee; color: #555; margin: 1px 2px 1px 0; }
.badge.green { background: var(--green-light); color: #5c7010; }
.badge.red { background: #fdecec; color: var(--red); }
.badge.blue { background: var(--blue-light); color: var(--blue-dark); }
.perm-matrix th, .perm-matrix td { text-align: center; }
.perm-matrix td:first-child, .perm-matrix th:first-child { text-align: left; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Dialoge ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(30, 30, 30, .45); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: #fff; border-radius: 6px; box-shadow: 0 10px 40px rgba(0, 0, 0, .25); width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal.wide { max-width: 860px; }
.modal-head { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; border-top: 4px solid var(--green); border-radius: 6px 6px 0 0; }
.modal-head h3 { margin: 0; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; background: #fafafa; border-radius: 0 0 6px 6px; }
.modal-foot .left { margin-right: auto; }
.segmented { display: inline-flex; border: 1px solid #cfcfcf; border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; }
.segmented label { margin: 0; padding: 7px 16px; cursor: pointer; font-weight: 600; color: var(--muted); }
.segmented input { display: none; }
.segmented label:has(input:checked) { background: var(--green); color: #fff; }
.segmented label.vac:has(input:checked) { background: var(--red); }
.weekdays { display: flex; gap: 4px; flex-wrap: wrap; }
.weekdays label { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 32px; border: 1px solid #cfcfcf; border-radius: var(--radius); cursor: pointer; margin: 0; font-weight: 600; }
.weekdays input { display: none; }
.weekdays label:has(input:checked) { background: var(--blue); color: #fff; border-color: var(--blue); }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px 4px; margin: 0 0 12px; }
legend { font-weight: 600; font-size: 12.5px; padding: 0 6px; color: #444; }
.color-presets { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.color-presets button { width: 24px; height: 24px; padding: 0; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #ccc; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; font-family: Consolas, monospace; font-size: 15px; background: var(--bg); padding: 12px; border-radius: var(--radius); }

/* Toasts */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #323232; color: #fff; padding: 10px 16px; border-radius: var(--radius); box-shadow: var(--shadow); max-width: 420px; display: flex; gap: 12px; align-items: center; }
.toast.error { background: var(--red); }
.toast.ok { background: #5c7a0c; }
.toast button { color: #fff; border-color: rgba(255, 255, 255, .5); background: transparent; padding: 3px 10px; }

/* ---------- Anmeldung ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, #fff 0%, var(--green-light) 100%); }
.login-card { background: #fff; width: 100%; max-width: 400px; border-radius: 8px; box-shadow: var(--shadow); padding: 28px 28px 22px; border-top: 5px solid var(--green); }
.login-card .logo { text-align: center; margin-bottom: 16px; }
.login-card .logo img { max-width: 260px; max-height: 70px; }
.login-card h1 { font-size: 20px; text-align: center; margin-bottom: 4px; }
.login-card .sub { text-align: center; color: var(--muted); margin-bottom: 20px; }
.login-card button.primary, .login-card button.blue, .login-card .full { width: 100%; justify-content: center; padding: 10px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--gray); font-size: 12px; margin: 14px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.qr { text-align: center; margin: 10px 0; }
.qr img { border: 1px solid var(--border); border-radius: var(--radius); }
.code-input { font-size: 22px; letter-spacing: .3em; text-align: center; font-family: Consolas, monospace; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .sidebar.open { display: block; position: fixed; left: 64px; top: var(--header-h); bottom: 0; z-index: 40; box-shadow: var(--shadow); }
  .ribbon .title { min-width: 0; font-size: 15px; }
  .header-search { display: none; }
  .brand .sub { display: none; }
}
@media (min-width: 901px) { .only-mobile { display: none !important; } }

@media print {
  .app-header, .nav-rail, .sidebar, .ribbon { display: none !important; }
  .app { height: auto; }
}
