:root {
  color-scheme: light;
  --ink: #18324a;
  --muted: #64748b;
  --line: #e2e8f0;
  --paper: #ffffff;
  --surface: #f5f7fa;
  --teal: #197b71;
  --blue-soft: #eaf2fc;
  --red-soft: #fff0ee;
  --yellow-soft: #fff6e5;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  line-height: 1.45;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--surface); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid #8ecfc4; outline-offset: 3px;
}
[hidden] { display: none !important; }
.app-shell { max-width: 1180px; margin: auto; padding: 0 22px; }
.topbar { min-height: 90px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 42px; height: 42px; border-radius: 12px; background: #18324a; color: white; font-size: 25px; font-weight: 750; text-align: center; padding-top: 3px; }
.brand small { display: block; font-size: 10px; letter-spacing: .1em; color: var(--muted); font-weight: 750; }
.brand strong { display: block; font-size: 21px; letter-spacing: -.03em; }
.demo-pill { border: 1px solid #e0b581; border-radius: 999px; padding: 6px 10px; background: #fff7e9; color: #81551c; font-weight: 700; font-size: 12px; text-align: center; }
.main-nav { display: flex; gap: 8px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.main-nav button { background: transparent; color: var(--muted); padding: 12px 18px; border: none; border-bottom: 3px solid transparent; font-size: 14px; font-weight: 650; }
.main-nav button.active { color: var(--ink); border-color: var(--teal); }
.intro { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin: 22px 0 22px; }
.intro h1 { font-size: clamp(24px, 3.2vw, 34px); letter-spacing: -.045em; margin: 3px 0 4px; }
.intro p { margin: 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 700; color: var(--teal); }
.muted { color: var(--muted); font-size: 14px; }
.primary-btn { padding: 11px 17px; border-radius: 10px; border: 1px solid #18324a; background: #18324a; color: #fff; font-weight: 680; white-space: nowrap; }
.primary-btn:hover { background: #28506f; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 17px; }
.summary-item { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 17px; min-height: 95px; }
.summary-item strong { display: block; font-size: 29px; letter-spacing: -.05em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.summary-item span { display: block; color: var(--muted); font-size: 13px; margin-top: 8px; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 18px; margin-bottom: 17px; min-width: 0; }
.panel-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 15px; }
.panel h2 { font-size: 17px; letter-spacing: -.02em; margin: 0 0 12px; }
.panel-header h2 { margin: 0; }
.week-controls { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; }
.week-controls > button:not(.text-btn) { border: 1px solid var(--line); background: var(--paper); border-radius: 8px; width: 30px; height: 30px; font-size: 20px; line-height: 1; }
.text-btn { border: none; background: transparent; padding: 7px; color: var(--teal); font-weight: 650; font-size: 13px; }
.week-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.day { border: 1px solid var(--line); background: #fafbfd; border-radius: 10px; min-height: 86px; padding: 12px 8px; text-align: center; color: var(--ink); }
.day:hover { border-color: #8dc8bf; }
.day.selected { background: #e9f6f3; border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); }
.day.today .day-number { color: var(--teal); font-weight: 800; }
.day-name { display: block; font-size: 11px; text-transform: uppercase; color: var(--muted); }
.day-number { display: block; margin: 4px 0; font-size: 22px; font-weight: 650; }
.day-count { display: block; font-size: 11px; color: var(--muted); }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(265px, 1fr); align-items: start; gap: 17px; }
.event-card { display: flex; gap: 13px; border-top: 1px solid var(--line); padding: 14px 0; }
.event-card:first-child { border-top: 0; padding-top: 3px; }
.event-day { flex: 0 0 53px; color: var(--muted); font-size: 12px; font-weight: 650; text-align: right; padding-top: 5px; font-variant-numeric: tabular-nums; }
.event-main { flex: 1; min-width: 0; }
.event-main h3 { font-size: 14px; line-height: 1.45; margin: 5px 0 2px; }
.event-main p { margin: 3px 0; overflow-wrap: anywhere; }
.type-pill { display: inline-block; font-size: 10px; letter-spacing: .03em; font-weight: 800; border-radius: 7px; padding: 3px 7px; color: #295889; background: var(--blue-soft); }
.type-pill.frist { color: #875418; background: var(--yellow-soft); }
.type-pill.wiedervorlage { color: #136759; background: #e4f5f0; }
.empty { padding: 28px 14px; text-align: center; color: var(--muted); font-size: 14px; }
.attention { border-top: 1px solid var(--line); padding: 12px 0; }
.attention:first-child { border-top: none; }
.attention strong { font-size: 14px; display: block; }
.attention span { color: var(--muted); font-size: 12px; }
.attention.warn strong { color: #ac4933; }
.inline-note { background: var(--yellow-soft); border-radius: 10px; padding: 12px; font-size: 13px; color: #684b23; }
.contact-card { border-top: 1px solid var(--line); padding: 15px 0; }
.contact-card:first-child { border-top: none; }
.contact-card h3 { margin: 0; font-size: 15px; }
.contact-card p { color: var(--muted); margin: 4px 0; font-size: 13px; }
footer { padding: 20px 0 32px; text-align: center; font-size: 11px; color: var(--muted); }
dialog { border: none; border-radius: 16px; padding: 0; width: min(94vw, 510px); max-height: 90vh; overflow-y: auto; box-shadow: 0 16px 60px #18324a30; color: var(--ink); }
dialog::backdrop { background: #142c42a0; }
#entry-form { padding: 24px; display: flex; flex-direction: column; gap: 9px; }
.dialog-title-row { display: flex; align-items: center; justify-content: space-between; }
.dialog-title-row h2 { margin: 0; font-size: 22px; }
.icon-button { border: none; background: transparent; font-size: 18px; color: var(--muted); padding: 6px; }
#entry-form label { font-size: 13px; font-weight: 700; margin-top: 7px; }
#entry-form input, #entry-form select, #entry-form textarea { width: 100%; padding: 11px 12px; border: 1px solid #cbd5e1; border-radius: 9px; background: #fff; color: var(--ink); }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
.dialog-actions > button:not(.primary-btn) { padding: 10px 14px; background: white; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); }
@media (max-width: 720px) {
  .app-shell { padding: 0 13px; }
  .topbar { min-height: 77px; }
  .brand strong { font-size: 18px; }
  .brand-mark { width: 39px; height: 39px; }
  .demo-pill { font-size: 10px; max-width: 110px; }
  .main-nav button { flex: 1; padding: 13px 3px; font-size: 13px; }
  .intro { margin: 16px 0; }
  .intro h1 { font-size: 25px; }
  .intro .primary-btn { width: 100%; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .summary-item { min-height: 79px; padding: 12px; }
  .summary-item strong { font-size: 24px; }
  .panel { padding: 14px; }
  .content-grid { display: block; }
  .day { min-height: 67px; padding: 8px 2px; }
  .day-number { font-size: 18px; }
  .day-count { font-size: 9px; }
  .week-controls { gap: 4px; }
  .week-controls > span { max-width: 100px; text-align: center; }
  .event-day { flex-basis: 45px; }
  .panel-header h2 { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; } }

/* Private account panel. */
.auth-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 5px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #eef3f6;
  color: var(--muted);
  font-size: 12px;
}
.auth-strip-actions { display: flex; align-items: center; gap: 5px; }
.auth-panel { max-width: 470px; margin-top: 12px; }
.auth-panel form { display: grid; gap: 9px; margin: 12px 0; }
.auth-panel label { font-size: 13px; font-weight: 700; }
.auth-panel input {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  background: white;
}
.auth-panel button[type="submit"] { justify-self: start; margin-top: 8px; }
@media (max-width: 720px) {
  .auth-strip { font-size: 11px; }
  .auth-panel button[type="submit"] { justify-self: stretch; }
}

/* Shared workspace */
button:disabled { cursor: wait; opacity: .58; }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.locked-panel { margin-top: 24px; padding: 28px; }
.locked-panel h1 { font-size: clamp(23px, 4vw, 31px); }
.workspace-message { padding: 12px 16px; border: 1px solid #a5d5c8; border-radius: 10px; background: #e9f6f3; font-size: 14px; }
.workspace-message.error, .form-error { background: #fff0ee; color: #8c3424; border: 1px solid #e3b4aa; border-radius: 9px; padding: 12px; }
.record-card { padding: 16px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.record-card:first-child { border-top: 0; }
.record-card p { margin: 7px 0; }
.record-card h3 { margin: 0; font-size: 16px; }
.record-header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.record-header .text-btn { flex-shrink: 0; padding-left: 0; }
.record-date { font-weight: 650; font-size: 13px; color: var(--teal); }
.audit { color: var(--muted); font-size: 11px; margin-top: 10px !important; }
.preserve-lines { white-space: pre-wrap; font-size: 14px; overflow-wrap: anywhere; }
.org-grid { grid-template-columns: minmax(230px, .8fr) minmax(0, 1.6fr); }
.organization-card { border-bottom: 1px solid var(--line); padding: 12px 0; overflow-wrap: anywhere; }
.organization-card:last-child { border-bottom: 0; }
.organization-card p { margin: 5px 0; }
.organization-link { color: var(--ink); background: transparent; border: 0; text-align: left; padding: 6px 0; font-size: 16px; font-weight: 750; width: 100%; }
.organization-link[aria-current] { color: var(--teal); }
.detail-section { margin-top: 26px; padding-top: 16px; border-top: 2px solid var(--line); }
.detail-section > .panel-header > h3 { margin: 0; font-size: 16px; }
.detail-section .empty { padding: 12px 0; text-align: left; }
.detail-section .record-card h3 { font-size: 14px; }
.search-label { display: block; font-size: 13px; font-weight: 650; margin-bottom: 6px; }
.search-input { width: 100%; margin-bottom: 18px; padding: 12px; border: 1px solid #cbd5e1; border-radius: 10px; background: white; color: var(--ink); }
.followup-group.overdue { border-left: 4px solid #c26c52; }
.followup-group.today { border-left: 4px solid var(--teal); }
.followup-group.undated { border-left: 4px solid #b4965e; }
#form-fields { display: flex; flex-direction: column; gap: 10px; }
.form-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-field small { font-size: 12px; }
#entry-form { gap: 12px; }
#entry-form input, #entry-form select, #entry-form textarea { min-width: 0; }
#entry-form [disabled] { color: #5f6e7c; background: #f2f5f7; }
#entry-form label { margin-top: 0; }
#form-hint { margin: 0 0 8px; }
#conflict-actions { padding: 12px; background: var(--yellow-soft); border-radius: 8px; font-size: 13px; }
#entry-dialog { width: min(94vw, 640px); }
@media (max-width: 720px) {
  .org-grid { display: block; }
  .toolbar { width: 100%; }
  .toolbar .primary-btn { flex: 1; }
  .record-header { align-items: flex-start; }
  .record-header .text-btn { font-size: 12px; }
  #entry-form { padding: 18px; }
  #entry-form input, #entry-form select, #entry-form textarea, .search-input, #auth-form input { font-size: 16px; }
  .dialog-actions .primary-btn { flex: 1; }
  .week-controls { flex-wrap: wrap; }
  .week-controls > span { max-width: none; font-size: 11px; }
}

.contact-links { display: flex; gap: 8px 16px; flex-wrap: wrap; }
.contact-links a { color: var(--teal); text-underline-offset: 3px; overflow-wrap: anywhere; }

/* Sprint B: daily-use actions, owner filters and touch-friendly task navigation. */
.secondary-btn {
  background: #edf5f4;
  color: var(--ink);
  border: 1px solid #9dc9c3;
  border-radius: 10px;
  padding: 10px 13px;
  font-weight: 650;
  white-space: normal;
  text-align: center;
}
.secondary-btn:hover { background: #ddf0ed; }
.filter-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 15px 0;
}
.filter-toolbar label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 190px;
  max-width: 330px;
  font-size: 13px;
  font-weight: 650;
}
.filter-toolbar select {
  background: white;
  color: var(--ink);
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  padding: 11px 12px;
  max-width: 100%;
  min-height: 44px;
}
.task-group.overdue { border-left: 4px solid #c26c52; }
.task-group.today { border-left: 4px solid var(--teal); }
.task-group.undated { border-left: 4px solid #b4965e; }
.task-group.doing { border-left: 4px solid #84a2c6; }
.install-help { margin: 12px auto 0; max-width: 780px; font-size: 12px; text-align: left; }
.install-help summary { cursor: pointer; text-align: center; font-weight: 650; }
.install-help p { line-height: 1.55; }
.record-card a, .contact-links a { overflow-wrap: anywhere; }
@media (max-width: 720px) {
  .topbar { gap: 8px; }
  .main-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 8px; }
  .main-nav button { flex: initial; min-width: 0; min-height: 44px; padding: 10px 7px; white-space: normal; }
  .toolbar { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; }
  .toolbar .secondary-btn { grid-column: 1 / -1; min-height: 44px; }
  .toolbar .primary-btn { grid-column: 1 / -1; min-height: 44px; }
  .toolbar .text-btn { grid-column: 1 / -1; justify-self: end; min-height: 42px; }
  .filter-toolbar { display: grid; grid-template-columns: 1fr; gap: 10px; }
  .filter-toolbar label { width: 100%; max-width: none; }
  .record-header .text-btn { min-height: 44px; }
  .detail-section .panel-header .secondary-btn { width: 100%; min-height: 44px; }
  .main-nav:focus-within { scroll-behavior: smooth; }
}

/* Lucerna: a quiet sign-in and a compact calendar with a readable day agenda. */
body.signed-out .app-shell { min-height: 100dvh; display: grid; align-content: center; }
.auth-panel { width: min(100%, 360px); margin: 40px auto; }
.auth-panel form { margin: 0; gap: 12px; }
.auth-panel input { width: 100%; min-height: 48px; }
.auth-panel button[type="submit"] { justify-self: stretch; min-height: 48px; }
.auth-panel label:not(:first-child) { margin-top: 8px; }
.auth-panel #auth-message:empty { display: none; }
.topbar .auth-strip { margin: 0; border: 0; background: transparent; padding: 0; }
.calendar-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.calendar-view-switch { display: flex; padding: 3px; border-radius: 11px; background: var(--surface); }
.calendar-view-switch button { min-height: 44px; padding: 8px 16px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); }
.calendar-view-switch button[aria-pressed="true"] { background: white; color: var(--teal); box-shadow: 0 1px 5px #18324a14; font-weight: 700; }
.week-controls > button:not(.text-btn), .week-controls > .text-btn { min-width: 44px; min-height: 44px; }
.week-controls > span { min-width: 160px; text-align: center; }
.calendar-weekday-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; text-align: center; color: var(--muted); font-size: 12px; margin: 8px 0; }
.week-days.month-days { gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.month-day { min-width: 0; min-height: 140px; padding: 4px; background: white; }
.month-day.outside-month { background: #f5f7f9; }
.month-day.selected { background: #ecf8f4; box-shadow: inset 0 0 0 2px var(--teal); }
.month-day-number { border: 0; background: transparent; min-width: 44px; min-height: 44px; border-radius: 50%; color: var(--ink); font-weight: 650; }
.month-day.today .month-day-number { background: var(--teal); color: white; }
.month-entry { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; width: 100%; min-height: 38px; border: 0; border-radius: 5px; background: var(--blue-soft); color: var(--ink); text-align: left; margin: 3px 0; padding: 4px 6px; font-size: 12px; line-height: 1.35; }
.month-entry.milestone { background: #e0f3ed; color: #176c5b; }
.month-more { border: 0; background: transparent; color: var(--teal); font-size: 12px; padding: 4px; min-height: 32px; }
.month-more.only-mobile { display: none; }
.calendar-milestone { border-left: 3px solid #7dc8b5; padding-left: 14px; }
@media (max-width: 600px) {
  .calendar-panel { padding: 10px; }
  .calendar-toolbar { justify-content: center; gap: 8px; }
  .calendar-toolbar .week-controls { justify-content: center; width: 100%; gap: 2px; }
  .week-controls > span { min-width: 128px; font-size: 13px; }
  .week-controls > button:not(.text-btn), .week-controls > .text-btn { padding: 4px; }
  .month-day { min-height: 86px; padding: 0; text-align: center; }
  .month-day-number { width: 100%; min-width: 0; border-radius: 6px; }
  .month-entry { display: none; }
  .month-more, .month-more.only-mobile { display: block; width: 100%; font-size: 10px; padding: 2px; min-height: 38px; overflow-wrap: anywhere; }
  .week-days:not(.month-days) { gap: 3px; }
  .day { padding: 9px 1px; }
  .day-count { font-size: 10px; }
  .auth-strip { flex-wrap: wrap; justify-content: flex-end; }
}

.dialog-actions .delete-entry { margin-right: auto; color: #85594c; }
