:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #172033;
  --muted: #6d7688;
  --line: #e5e9f0;
  --primary: #3659d9;
  --primary-dark: #2947ba;
  --danger: #c83f49;
  --shadow: 0 18px 45px rgba(26, 36, 64, .08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--text); background: var(--bg); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 20%, rgba(54,89,217,.16), transparent 30%),
    radial-gradient(circle at 85% 80%, rgba(85,198,155,.18), transparent 28%),
    var(--bg);
}
.login-card {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid rgba(229,233,240,.9);
  border-radius: 28px;
  padding: 38px;
  box-shadow: var(--shadow);
}
.login-card h1 { margin: 16px 0 6px; font-size: 32px; }
.brand-mark {
  width: 52px; height: 52px; display: grid; place-items: center;
  border-radius: 16px; background: var(--primary); color: white;
  font-size: 27px; font-weight: 800;
}
.brand-mark.small { width: 40px; height: 40px; border-radius: 12px; font-size: 20px; }

.stack { display: grid; gap: 18px; margin-top: 28px; }
label { display: grid; gap: 8px; font-size: 14px; font-weight: 650; color: #384258; }
input, textarea {
  width: 100%; border: 1px solid var(--line); background: white;
  padding: 12px 13px; border-radius: 11px; outline: none; color: var(--text);
  transition: border .15s, box-shadow .15s;
}
input:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(54,89,217,.10); }
textarea { resize: vertical; }
.muted { color: var(--muted); }
.error-text { color: var(--danger); background: #fff0f1; padding: 10px 12px; border-radius: 10px; font-size: 14px; }

.primary, .secondary, .danger {
  border: 0; border-radius: 11px; padding: 12px 16px; font-weight: 750;
}
.primary { background: var(--primary); color: white; }
.primary:hover { background: var(--primary-dark); }
.secondary { background: #edf1f7; color: #364057; }
.danger { background: #fff0f1; color: var(--danger); }
.compact { padding: 9px 13px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: #111a2f; color: white; padding: 22px 16px;
  display: flex; flex-direction: column;
}
.sidebar-brand { display: flex; gap: 12px; align-items: center; padding: 0 8px 24px; }
.sidebar-brand div:last-child { display: grid; gap: 2px; }
.sidebar-brand span { color: #9aa6c0; font-size: 12px; }
.nav { display: grid; gap: 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: 0; border-radius: 11px; padding: 11px 12px;
  background: transparent; color: #c4cce0; text-align: left; font-weight: 650;
}
.nav-item:hover:not(.disabled), .nav-item.active { background: #1c2946; color: white; }
.nav-item span { width: 20px; text-align: center; }
.nav-item em { margin-left: auto; font-size: 10px; font-style: normal; color: #75809a; }
.nav-item.disabled { opacity: .55; cursor: default; }
.sidebar-bottom { margin-top: auto; border-top: 1px solid #27334d; padding: 16px 8px 0; }
.profile-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: #dce4ff; color: #2947ba; font-weight: 800; font-size: 13px;
}
.profile-text { display: grid; }
.profile-text span { color: #8f9bb4; font-size: 11px; }
.text-button { border: 0; background: transparent; color: #9aa6c0; padding: 12px 0 0; }

.content { padding: 28px clamp(20px, 4vw, 54px) 54px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; gap: 20px; align-items: center; margin-bottom: 26px; }
.eyebrow { margin: 0 0 4px; text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 800; color: var(--muted); }
.topbar h2 { margin: 0; font-size: 30px; }

.hero-card {
  display: flex; justify-content: space-between; gap: 24px; align-items: end;
  padding: 28px; background: linear-gradient(135deg, #eef2ff, #f5fbff);
  border: 1px solid #dde5ff; border-radius: var(--radius); margin-bottom: 20px;
}
.hero-card h3 { margin: 14px 0 5px; font-size: 25px; }
.pill { display: inline-block; padding: 6px 9px; border-radius: 999px; background: white; color: var(--primary); font-size: 11px; font-weight: 800; }
.dashboard-grid { display: grid; grid-template-columns: 1.5fr .8fr; gap: 20px; }
.panel, .calendar-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 28px rgba(26,36,64,.04); }
.panel { padding: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h3 { margin: 0; }
.link-button { border: 0; background: transparent; color: var(--primary); font-weight: 750; padding: 5px; }
.counter { min-width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #eef2ff; color: var(--primary); font-weight: 800; font-size: 12px; }

.event-list { display: grid; gap: 10px; }
.event-row {
  border: 1px solid var(--line); border-radius: 13px; padding: 13px;
  display: grid; grid-template-columns: 58px 1fr auto; gap: 12px; align-items: center;
  background: white;
}
.event-row:hover { border-color: #cdd6ea; }
.event-date { text-align: center; line-height: 1.05; }
.event-date strong { display: block; font-size: 20px; }
.event-date span { font-size: 10px; color: var(--muted); text-transform: uppercase; }
.event-main strong { display: block; margin-bottom: 4px; }
.event-main span, .event-people { color: var(--muted); font-size: 12px; }
.empty-state { padding: 26px 10px; text-align: center; color: var(--muted); }

.member-list { display: grid; gap: 10px; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.member-row .avatar { flex: 0 0 auto; }
.member-row div:last-child { display: grid; }
.member-row span { font-size: 11px; color: var(--muted); }

.calendar-toolbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; margin-bottom: 14px; }
.calendar-toolbar h3 { margin: 0; text-align: center; font-size: 22px; }
.month-controls { display: flex; gap: 7px; align-items: center; }
.icon-button {
  width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px;
  background: white; color: #485268; font-size: 22px; display: grid; place-items: center;
}
.legend { display: flex; justify-content: flex-end; gap: 7px; flex-wrap: wrap; font-size: 11px; color: var(--muted); }
.legend-filter { background: white; border: 1px solid var(--line); border-radius: 999px; padding: 5px 8px; color: var(--muted); font: inherit; cursor: pointer; transition: 0.15s ease; }
.legend-filter:hover { border-color: #9fb1ff; color: var(--text); }
.legend-filter.active { border-color: var(--primary); color: var(--primary); background: #eef2ff; font-weight: 750; }

.calendar-card { overflow: hidden; }
.weekday-row, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.weekday-row { background: var(--surface-soft); border-bottom: 1px solid var(--line); }
.weekday-row span { padding: 11px 8px; text-align: center; color: var(--muted); font-size: 11px; font-weight: 800; }
.day-cell {
  min-height: 122px; padding: 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: white; overflow: hidden;
}
.day-cell:nth-child(7n) { border-right: 0; }
.day-cell.outside { background: #fafbfd; color: #abb2c0; }
.day-number { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-size: 12px; font-weight: 750; }
.day-cell.today .day-number { background: var(--primary); color: white; }
.day-events { display: grid; gap: 4px; margin-top: 5px; }
.event-chip {
  width: 100%; border: 0; text-align: left; padding: 5px 7px;
  border-radius: 7px; background: #eef2ff; color: #2f4daf; font-size: 11px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.event-chip.family { background: #edf8f4; color: #24745a; }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000; background: rgba(12,18,32,.55);
  display: grid; place-items: center; padding: 20px;
}
.modal {
  width: min(680px, 100%); max-height: calc(100vh - 40px); overflow: auto;
  background: white; border-radius: 22px; box-shadow: 0 30px 80px rgba(0,0,0,.25);
  padding: 24px;
}
.modal-head { display: flex; justify-content: space-between; align-items: start; margin-bottom: 18px; }
.modal-head h3 { margin: 0; font-size: 24px; }
.event-form { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.full { grid-column: 1 / -1; }
.checkbox-label { display: flex; align-items: center; gap: 9px; }
.checkbox-label input { width: auto; }
fieldset { border: 1px solid var(--line); border-radius: 13px; padding: 13px; }
legend { font-size: 13px; font-weight: 750; padding: 0 5px; }
.hint { margin: 0 0 10px; color: var(--muted); font-size: 11px; }
.participant-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.person-choice input { display: none; }
.person-choice span {
  display: inline-block; border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 11px; font-size: 12px; font-weight: 700; background: white;
}
.person-choice input:checked + span { border-color: var(--primary); background: #eef2ff; color: var(--primary); }
.modal-actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.action-spacer { flex: 1; }

.toast {
  position: fixed; right: 22px; bottom: 22px; z-index: 2000;
  background: #172033; color: white; border-radius: 12px; padding: 12px 15px;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(10px);
  transition: .2s;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 76px 1fr; }
  .sidebar { padding-inline: 10px; }
  .sidebar-brand div:last-child, .nav-item:not(.active) em, .nav-item { font-size: 0; }
  .sidebar-brand { justify-content: center; padding-inline: 0; }
  .nav-item { justify-content: center; }
  .nav-item span { font-size: 18px; }
  .profile-text, .text-button { display: none; }
  .profile-chip { justify-content: center; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .calendar-toolbar { grid-template-columns: 1fr; }
  .calendar-toolbar h3 { order: -1; }
  .legend { justify-content: flex-start; }
}

@media (max-width: 640px) {
  .app-shell { display: block; }
  .sidebar {
    position: fixed; z-index: 500; top: auto; bottom: 0; left: 0; right: 0;
    width: 100%; height: 66px; padding: 8px 10px;
    flex-direction: row; align-items: center;
  }
  .sidebar-brand, .sidebar-bottom, .nav-item.disabled { display: none; }
  .nav { width: 100%; grid-template-columns: 1fr 1fr; gap: 8px; }
  .nav-item { font-size: 12px; flex-direction: column; gap: 2px; padding: 6px; }
  .nav-item span { font-size: 17px; }
  .content { padding: 18px 14px 88px; }
  .topbar h2 { font-size: 25px; }
  .hero-card { align-items: stretch; flex-direction: column; }
  .event-form { grid-template-columns: 1fr; }
  .event-form > * { grid-column: 1; }
  .day-cell { min-height: 84px; padding: 4px; }
  .event-chip { font-size: 9px; padding: 4px; }
  .weekday-row span { padding-inline: 2px; }
  .event-row { grid-template-columns: 48px 1fr; }
  .event-people { display: none; }
}

/* Schichtplan-Import V1 */
.topbar-actions { display: flex; gap: 9px; align-items: center; }
.shift-modal { width: min(860px, 100%); }
.shift-import-stack { display: grid; gap: 16px; }
.shift-step { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; border: 1px solid var(--line); border-radius: 15px; padding: 15px; }
.step-badge { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #eef2ff; color: var(--primary); font-size: 12px; font-weight: 850; }
.step-content h4 { margin: 2px 0 6px; font-size: 15px; }
.upload-box { display: grid; gap: 4px; border: 1.5px dashed #b9c4df; border-radius: 13px; padding: 18px; background: #fafbff; cursor: pointer; text-align: center; }
.upload-box:hover { border-color: var(--primary); background: #f5f7ff; }
.upload-box strong { color: var(--primary); }
.upload-box span { color: var(--muted); font-size: 11px; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
.shift-image-preview { margin-top: 12px; border: 1px solid var(--line); border-radius: 13px; padding: 10px; background: #fafbfd; }
.shift-image-preview img { display: block; max-width: 100%; max-height: 290px; margin: 0 auto 8px; border-radius: 9px; object-fit: contain; }
.text-button.inline { padding: 4px 0; color: var(--primary); }
.shift-preview-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.shift-table-head, .shift-row { display: grid; grid-template-columns: 1.2fr .8fr .8fr 1.5fr 36px; gap: 8px; align-items: center; }
.shift-table-head { margin-top: 12px; padding: 0 4px 6px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.shift-rows { display: grid; gap: 7px; }
.shift-row input { padding: 9px 10px; font-size: 12px; }
.shift-remove { width: 34px; height: 34px; border: 0; border-radius: 9px; background: #fff0f1; color: var(--danger); font-size: 18px; }
.shift-empty { padding: 18px 10px; text-align: center; color: var(--muted); background: #fafbfd; border-radius: 10px; font-size: 12px; }
.shift-info { display: grid; gap: 4px; padding: 12px 14px; border-radius: 12px; background: #edf8f4; color: #24604f; font-size: 12px; }
.shift-info span { opacity: .88; }

@media (max-width: 700px) {
  .topbar { align-items: flex-start; }
  .topbar-actions { flex-direction: column-reverse; align-items: stretch; }
  .topbar-actions button { width: 100%; }
  .shift-step { grid-template-columns: 1fr; }
  .step-badge { margin-bottom: -3px; }
  .shift-table-head { display: none; }
  .shift-row { grid-template-columns: 1fr 1fr; padding: 10px; border: 1px solid var(--line); border-radius: 11px; }
  .shift-row input:nth-of-type(1), .shift-row input:nth-of-type(4) { grid-column: 1 / -1; }
  .shift-remove { justify-self: end; grid-column: 2; }
}

/* Schichtplan OCR V2 */
.shift-reminder-field { display: grid; gap: 7px; margin-top: 14px; max-width: 420px; font-weight: 700; color: var(--text, #172033); }
.shift-reminder-field select { width: 100%; }
.shift-image-actions { display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.shift-recognition-status { margin-top: 12px; padding: 11px 14px; border-radius: 12px; background: #eef4ff; color: #284ea8; font-weight: 700; }
.shift-recognition-status.error { background: #fff0f0; color: #b42318; }


/* PWA-Installationshinweis */
.install-app-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
  padding: 15px 16px;
  background: linear-gradient(135deg, #eef2ff, #f7f9ff);
  border: 1px solid #cfd8ff;
  border-radius: 15px;
  box-shadow: 0 8px 24px rgba(54, 89, 217, .08);
}
.install-app-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #fff;
  font-size: 23px;
}
.install-app-copy { display: grid; gap: 3px; }
.install-app-copy strong { font-size: 14px; }
.install-app-copy span { color: var(--muted); font-size: 12px; line-height: 1.4; }
.install-app-actions { display: flex; gap: 10px; align-items: center; }
.install-app-actions .text-button { padding: 8px 2px; color: var(--muted); }

@media (max-width: 700px) {
  .install-app-card { grid-template-columns: auto 1fr; }
  .install-app-actions { grid-column: 1 / -1; width: 100%; }
  .install-app-actions .primary { flex: 1; }
}


/* Einstellungen V6 */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.settings-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 8px 28px rgba(26,36,64,.04);
}
.settings-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.settings-card-head h3 { margin: 0; font-size: 18px; }
.settings-card-head .eyebrow { margin-bottom: 2px; }
.settings-icon {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: #eef2ff;
  font-size: 21px;
}
.settings-copy {
  margin: 0 0 15px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.settings-action { width: 100%; margin-top: 12px; }
.settings-actions { display: flex; gap: 10px; margin-top: 14px; }
.settings-actions > * { flex: 1; }
.settings-status-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 11px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.settings-status-row span { color: var(--muted); }
.settings-status-row strong { text-align: right; }
.settings-hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}
.settings-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}
.settings-avatar { width: 46px; height: 46px; }
.settings-profile > div:last-child { display: grid; gap: 3px; }
.settings-subline { color: var(--muted); font-size: 12px; }
.settings-family-list { display: grid; gap: 8px; }
.settings-family-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}
.settings-family-copy { display: grid; gap: 2px; }
.settings-family-copy span { color: var(--muted); font-size: 11px; }
.settings-empty { color: var(--muted); font-size: 12px; padding: 10px 0; }
.settings-card-danger { border-color: #f3d7da; }

@media (max-width: 900px) {
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .nav { grid-template-columns: repeat(4, 1fr); }
  .settings-card { padding: 16px; }
  .settings-actions { flex-direction: column; }
}


/* Admin-Bereich V7 */
.admin-nav-item {
  border: 1px solid rgba(255,255,255,.08);
}
.admin-nav-item.active {
  background: #312853;
  color: #fff;
}
.admin-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 22px;
  margin-bottom: 18px;
  border: 1px solid #ddd5ff;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #f4f1ff, #eef2ff);
}
.admin-hero h3 { margin: 0 0 6px; font-size: 24px; }
.admin-hero p:last-child { margin: 0; color: var(--muted); font-size: 13px; }
.admin-shield {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: #fff;
  font-size: 28px;
  box-shadow: 0 8px 24px rgba(63,48,120,.10);
}

@media (max-width: 640px) {
  .nav { grid-template-columns: repeat(4, 1fr); }
  .admin-hero { align-items: flex-start; }
  .admin-shield { width: 50px; height: 50px; font-size: 24px; }
}
