:root {
  --bg: #efefed;
  --surface: #ffffff;
  --text: #30200d;
  --text-muted: #4f4a43;
  --border: #c8ceca;
  --accent: #e60000;
  --accent-dark: #b80000;
  --accent-contrast: #ffffff;
  --danger: #b80000;
  --sidebar-bg: #30200d;
  --sidebar-text: #efefed;
  --sidebar-muted: #a89f92;
  --sidebar-active: #4f4a43;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a {
  color: inherit;
}

.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 230px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Auf dem PC bleibt die Seitenleiste beim Scrollen stehen (Menü scrollt für sich); so wird die Seite nicht
   künstlich so lang wie das Menü, und die Leiste unten am Board kann am Bildschirmrand kleben. */
@media (min-width: 901px) {
  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    align-self: flex-start;
    box-sizing: border-box;
  }

  .sidebar .nav {
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
  }
}

.brand {
  padding: 0 8px;
}

.brand-logo {
  width: 100%;
  max-width: 150px;
  height: auto;
  display: block;
}

.nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Benutzer oben, darunter die Knöpfe untereinander; nichts ragt in den Inhalt hinein */
.sidebar-footer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 14px 8px 0;
  border-top: 1px solid rgba(239, 239, 237, 0.12);
  min-width: 0;
}

.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-actions form {
  margin: 0;
}

.sidebar-actions .sidebar-logout {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
}

.sidebar-user-role {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sidebar-muted);
}

.sidebar-logout {
  color: var(--sidebar-text);
  font-size: 13px;
  padding: 6px 10px;
}

.sidebar-logout:hover {
  background: var(--sidebar-active);
  color: var(--sidebar-text);
}

.nav-group {
  margin: 14px 8px 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sidebar-muted);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 500;
}

.nav-link:hover {
  background: var(--sidebar-active);
}

.nav-link.active {
  background: var(--accent);
  color: var(--accent-contrast);
}

.nav-link.disabled {
  color: var(--sidebar-muted);
  cursor: default;
  pointer-events: none;
}

.nav-icon {
  font-size: 15px;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  padding: 28px 36px 0;
}

.topbar h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.content {
  padding: 12px 36px 48px;
  flex: 1;
}

.subtitle {
  color: var(--text-muted);
  margin: 4px 0 20px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-decoration: none;
  color: var(--text);
  display: block;
}

.card-muted {
  opacity: 0.6;
}

.card-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.card-value {
  font-size: 32px;
  font-weight: 700;
}

.card-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  max-width: 560px;
}

.panel h2 {
  margin-top: 0;
  font-size: 16px;
}

.steps {
  margin: 0;
  padding-left: 18px;
  color: var(--text-muted);
  line-height: 1.7;
}

.steps a {
  color: var(--accent-dark);
  font-weight: 600;
  text-decoration: none;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.checkbox-inline {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 6px;
  font-weight: 400 !important;
  font-size: 14px !important;
  color: var(--text) !important;
}

.checkbox-inline input {
  width: auto;
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: var(--bg);
}

.dropzone-text {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

.reorder-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reorder-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
}

.reorder-label {
  font-weight: 600;
}

.reorder-actions {
  display: flex;
  gap: 6px;
}

.reorder-actions form button {
  padding: 4px 12px;
}

.tab-config-link {
  margin-left: auto;
  align-self: center;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 16px;
  padding: 4px 8px;
}

.tab-config-link:hover {
  color: var(--accent);
}

.filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
}

.filter-tab.active {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  background: var(--surface);
  color: var(--text);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

.btn-primary:hover {
  background: var(--accent-dark);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
  padding: 6px 10px;
}

.btn-ghost:hover {
  background: var(--bg);
  color: var(--text);
}

.btn-danger:hover {
  color: var(--danger);
}

.empty-state {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th,
.table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
}

.table tr:last-child td {
  border-bottom: none;
}

.row-inactive {
  opacity: 0.55;
}

.row-name {
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
}

.row-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.row-actions form {
  display: inline;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-active {
  background: #e7f2e4;
  color: #3c7a3e;
}

.badge-inactive {
  background: #f0ece5;
  color: var(--text-muted);
}

.badge-overdue {
  background: #fbeae6;
  color: var(--danger);
}

.badge-tag {
  background: #eef0f4;
  color: var(--text-muted);
  margin: 0 4px 4px 0;
}

.hint {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 12px;
}

p.hint {
  margin: -8px 0 16px;
}

.back-link {
  display: inline-block;
  margin-bottom: 16px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
}

.form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 640px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.form label.full {
  margin-bottom: 16px;
}

.form input,
.form textarea,
.form select {
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.form input:focus,
.form textarea:focus,
.form select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.form-section-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.field-hint {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}

.field-hint a {
  color: var(--accent-dark);
  font-weight: 600;
}

.alert {
  background: #fbeae6;
  color: var(--danger);
  border: 1px solid #f0c9c0;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 14px;
}

.alert-success {
  background: #e8f5e9;
  color: #2e7d32;
  border-color: #c8e6c9;
}

.video-embed {
  position: relative;
  width: 100%;
  max-width: 640px;
  aspect-ratio: 16 / 9;
}

.video-embed iframe,
.video-embed video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: var(--radius);
  background: #000;
}

.pdf-embed {
  width: 100%;
  height: 70vh;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.pdf-embed embed {
  width: 100%;
  height: 100%;
}

.quiz-question {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 12px;
}

.quiz-question legend {
  font-weight: 600;
  padding: 0 4px;
}

.quiz-question .checkbox-inline {
  display: flex;
  margin: 6px 0;
}

.panel-form {
  max-width: none;
  margin-bottom: 24px;
}

.quick-form {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.quick-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.quick-form label.grow {
  flex: 1 1 260px;
}

.quick-form input,
.quick-form select {
  font-family: inherit;
  font-size: 14px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}

.quick-form input:focus,
.quick-form select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
}

.task-row.task-overdue {
  background: #fbeae6;
  border-color: var(--danger);
}

.task-row.task-due-today {
  background: #fff6d9;
  border-color: #d8a900;
}

.task-row.task-done {
  opacity: 0.75;
}

.task-check {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: transparent;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}

.task-check:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.task-check-done {
  color: var(--accent-contrast);
  background: var(--accent);
  border-color: var(--accent);
}

.task-main {
  flex: 1;
  min-width: 0;
}

.task-title {
  font-weight: 600;
}

.task-title-done {
  text-decoration: line-through;
  color: var(--text-muted);
  font-weight: 400;
}

.task-meta {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  gap: 6px;
  margin-top: 2px;
}

.task-due-overdue {
  color: var(--danger);
  font-weight: 600;
}

.task-due-today {
  color: var(--accent-dark);
  font-weight: 600;
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
}

.auth-logo {
  width: 100%;
  max-width: 170px;
  height: auto;
  margin: 0 auto 20px;
  display: block;
}

.auth-card h1 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 800;
}

.auth-card .subtitle {
  margin: 0 0 20px;
  text-align: center;
}

.auth-form {
  max-width: none;
  padding: 0;
  border: none;
  text-align: left;
}

.auth-form .form-actions {
  margin-top: 4px;
}

.auth-form button {
  width: 100%;
  justify-content: center;
}

.board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 12px;
  align-items: flex-start;
}

/* Board füllt den Bildschirm (Höhe setzt public/js/board-fit.js): Bildlaufleiste bleibt unten am Monitor */
body.board-page .content {
  padding-bottom: 12px;
}

body.board-page .board-column {
  max-height: 100%;
  min-height: 0;
}

body.board-page .board-column-body {
  overflow-y: auto;
  flex: 1 1 auto;
}

.board-column {
  flex: 0 0 270px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.board-column-header {
  padding: 2px 4px;
}

.board-column-title {
  font-weight: 700;
  font-size: 14px;
}

.board-column-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.board-column-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 90px;
  border-radius: 8px;
  transition: background-color 0.1s ease;
}

.board-column-body.drop-target {
  background: var(--accent-light, #fbe3e3);
  outline: 2px dashed var(--accent);
  outline-offset: 2px;
}

.deal-card {
  cursor: grab;
}

.deal-card.dragging {
  opacity: 0.4;
}

.board-empty {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  padding: 16px 0;
}

.deal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.deal-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.deal-value {
  font-weight: 700;
  color: var(--text);
}

.deal-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.deal-card-link:hover .deal-title {
  color: var(--accent-dark);
}

.deal-title {
  display: block;
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
  font-size: 14px;
  margin-bottom: 2px;
}

.deal-customer {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.deal-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.deal-actions {
  display: flex;
  gap: 6px;
}

.deal-actions form {
  flex: 1;
}

.deal-move {
  width: 100%;
  padding: 5px 0;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
}

.deal-move:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.deal-move:disabled {
  opacity: 0.35;
  cursor: default;
}

.deal-delete:hover:not(:disabled) {
  border-color: var(--danger);
  color: var(--danger);
}

.detail-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  align-items: start;
}

.detail-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel-wide {
  max-width: none;
}

/* Stammdaten: links die Bezeichnung, rechts der Wert, jede Angabe in einer eigenen Zeile */
.detail-list {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(130px, 210px) 1fr;
  gap: 12px 24px;
  align-items: baseline;
}

.detail-list dt {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0;
}

.detail-list dd {
  margin: 0;
  font-size: 14px;
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 600px) {
  .detail-list {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .detail-list dd {
    margin-bottom: 12px;
  }
}

/* Knöpfe unter den Stammdaten: durch eine Linie abgesetzt und auf einer Höhe */
.detail-list + .form-actions {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin: 16px 0;
}

.course-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 18px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-decoration: none;
  color: var(--text);
  border-top: 4px solid var(--course-color, var(--accent));
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.course-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.course-card-icon {
  font-size: 26px;
  line-height: 1;
  margin-bottom: 2px;
}

.course-card-title {
  font-weight: 600;
  font-size: 16px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  overflow: hidden;
  margin: 4px 0;
}

.progress-bar-fill {
  height: 100%;
  background: var(--course-color, var(--accent));
  border-radius: 999px;
  transition: width 0.2s ease;
}

.chapter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}

.chapter-header::-webkit-details-marker {
  display: none;
}

.chapter-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 16px;
}

.chapter-toggle-icon {
  transition: transform 0.15s ease;
  color: var(--text-muted);
  font-size: 13px;
}

details[open] > .chapter-header .chapter-toggle-icon {
  transform: rotate(90deg);
}

.lesson-type-icon {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 14px;
  margin-right: 2px;
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.doc-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  display: flex;
  flex-direction: column;
}

.doc-thumb {
  width: 100%;
  height: 100px;
  object-fit: cover;
  display: block;
  background: var(--bg);
}

.doc-file-icon {
  width: 100%;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  background: var(--bg);
}

.doc-card-body {
  padding: 8px 10px;
  font-size: 12px;
}

.doc-card-name {
  display: block;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-card-note {
  color: var(--text-muted);
  margin: 4px 0 0;
}

.doc-card-actions {
  padding: 0 10px 10px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  border: 1px solid transparent;
  border-bottom: none;
  background: none;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius) var(--radius) 0 0;
}

a.tab-btn {
  text-decoration: none;
}

.tab-btn.active {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}

[data-tab-panel] {
  border-top-left-radius: 0;
}

.diary-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.diary-entry {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.diary-entry-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.diary-entry-text {
  margin: 0 0 8px;
  white-space: pre-wrap;
}

@media (max-width: 900px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
}

.model-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.weekday-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin: 4px 0 16px;
}

.weekday-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.weekday-grid input {
  font-family: inherit;
  font-size: 13px;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  width: 100%;
}

.clock-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.alert-info {
  background: #eef3f6;
  color: var(--text);
  border: 1px solid #c9dbe4;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 20px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 720px;
}

.progress-bar {
  margin-top: 14px;
  height: 8px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
}

.event-list {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
  line-height: 1.9;
  color: var(--text);
}

.briefing-panel {
  max-width: none;
  margin-bottom: 20px;
  padding: 14px 20px;
  background: var(--surface);
}

.briefing-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.briefing-text {
  margin: 0;
  font-size: 14px;
}

@media (max-width: 720px) {
  .sidebar {
    display: none;
  }
  .content,
  .topbar {
    padding-left: 20px;
    padding-right: 20px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.diary-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.diary-photos img {
  width: 140px;
  height: 105px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: block;
}

.photo-thumb {
  position: relative;
}

.photo-thumb button {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  cursor: pointer;
  line-height: 1;
}

.photo-existing {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}

/* ===== Zeiterfassung (Büro) ===== */
.tz-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tz-filter { margin-bottom: 16px; }
.tz-filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.tz-filter-title { font-weight: 600; margin-bottom: 6px; }
.tz-checklist { max-height: 150px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; background: #fff; }
.tz-checklist .checkbox-inline { display: flex; padding: 2px 0; }
.tz-datebar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 16px 0; }
.tz-date-form { margin: 0; }
.tz-date-form input { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }
.tz-date-long { margin-left: 8px; }
.tz-viewtabs { margin: 0 0 0 auto; }
.tz-panel { overflow: hidden; }
.tz-table td, .tz-table th { vertical-align: top; }
.tz-table .num, .tz-report .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tz-table td.pos { color: #1f7a3d; }
.tz-table td.neg, .neg { color: var(--danger); }
.tz-name { white-space: nowrap; font-weight: 600; }
.tz-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.tz-dot.on { background: #2e9e5b; }
.tz-dot.off { background: #e04a3a; }
.tz-entries { min-width: 320px; }
.tz-entry { display: flex; align-items: flex-start; gap: 6px; padding: 4px 8px; margin-bottom: 4px; border-left: 4px solid #30424d; background: #f6f5f2; border-radius: 4px; }
.tz-entry a { color: inherit; text-decoration: none; display: block; flex: 1; }
.tz-entry a:hover strong { text-decoration: underline; }
.tz-entry-time, .tz-entry-cc { display: block; font-size: 12px; color: var(--text-muted); }
.tz-break { border-left-color: #b8b2a7; background: #fbfaf8; }
.tz-ok { color: #1f7a3d; font-weight: 700; }
.tz-absence { color: #fff; padding: 4px 8px; border-radius: 4px; margin-bottom: 4px; font-weight: 600; font-size: 13px; }
.tz-pending { background: repeating-linear-gradient(45deg, #d9d9d9, #d9d9d9 6px, #eee 6px, #eee 12px); color: var(--text); }
.tz-add { display: inline-block; width: 24px; height: 24px; line-height: 22px; text-align: center; border: 1px solid var(--border); border-radius: 50%; color: var(--text-muted); text-decoration: none; font-weight: 700; }
.tz-add:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.tz-chip { display: inline-block; color: #fff; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; margin: 2px; }

.tz-axis-wrap { overflow-x: auto; padding: 4px 0 12px; }
.tz-line { display: flex; align-items: center; min-width: 900px; border-bottom: 1px solid #ecebe7; }
.tz-line-name { width: 190px; flex: 0 0 190px; padding: 10px 8px; font-weight: 600; font-size: 14px; }
.tz-line-track { position: relative; flex: 1; height: 44px; margin: 4px 24px 4px 0; }
.tz-hours { height: 28px; }
.tz-hours span { position: absolute; top: 4px; transform: translateX(-50%); font-size: 11px; color: var(--text-muted); }
.tz-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: #e2e0da; }
.tz-bar { position: absolute; top: 6px; height: 32px; background: #30424d; border-radius: 6px; border: 1px solid #fff; box-sizing: border-box; color: #fff; font-size: 11px; line-height: 30px; padding: 0 6px; overflow: hidden; white-space: nowrap; text-decoration: none; }
.tz-bar-break { background: #cfc9bd; }
.tz-bar-run { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.18), rgba(255,255,255,.18) 6px, transparent 6px, transparent 12px); }
.tz-bar-absence { z-index: 1; }
.tz-soll { position: absolute; top: 6px; height: 32px; border: 1px dashed #b8b2a7; background: #f4f3f0; border-radius: 6px; }
.tz-add-line { position: absolute; right: -22px; top: 10px; }

.tz-manage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-top: 12px; }
.tz-card { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; text-decoration: none; color: var(--text); }
.tz-card:hover { border-color: var(--accent); }
.tz-card span { font-size: 13px; color: var(--text-muted); }

.tz-cal th, .tz-cal td { text-align: center; padding: 4px 2px; min-width: 26px; }
.tz-cal th:first-child, .tz-cal td:first-child { text-align: left; min-width: 160px; }
.tz-cal .we { background: #f0eeea; }
.tz-cal .ho { background: #fbefc2; }
.tz-cal-cell { display: block; color: #fff; font-size: 10px; font-weight: 700; border-radius: 3px; padding: 2px 0; }
.tz-cal-cell.pending { outline: 2px dashed rgba(0,0,0,.45); outline-offset: -2px; }
.tz-muted td { color: var(--text-muted); background: #f7f6f3; }
.tz-report-filter { margin-bottom: 8px; flex-wrap: wrap; }
.tz-report tfoot th { border-top: 2px solid var(--border); }

@media print {
  .sidebar, .topbar, .tz-report-filter, .toolbar-actions, .back-link { display: none !important; }
  .shell { display: block; }
}

.tz-filter, .tz-panel, .panel-wide { max-width: none; }
.tz-filter summary { cursor: pointer; }

.tz-table th, .tz-table td { padding-left: 8px; padding-right: 8px; }
.tz-entries { min-width: 280px; }

.tz-quick-row { display: grid; grid-template-columns: 2fr 1.2fr 100px 100px 1fr; gap: 6px; margin-top: 6px; }
.tz-quick-row select, .tz-quick-row input { padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; min-width: 0; }
@media (max-width: 900px) { .tz-quick-row { grid-template-columns: 1fr 1fr; } }

/* ===== Projektmappe (Auftrag-Reiter) ===== */
.tabs-wrap { flex-wrap: wrap; gap: 4px; }
.doc-crumbs { margin: 8px 0; font-weight: 600; }
.doc-crumbs a { color: var(--text); }
.doc-folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin: 10px 0; }
.doc-folder { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; text-decoration: none; color: var(--text); }
.doc-folder:hover { border-color: var(--accent); }
.doc-thumb-small { width: 48px; height: 48px; object-fit: cover; border-radius: 4px; display: block; }
.chat-box { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow: auto; padding: 8px; background: #f6f5f2; border-radius: 8px; margin: 10px 0; }
.chat-msg { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; white-space: pre-line; }
.chat-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 2px; }
.link-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 0 4px; }
.link-btn:hover { color: var(--danger); }

/* ===== Auswahlmenü mit Mehrfachauswahl ===== */
.ms { position: relative; }
.ms-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 38px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff; cursor: pointer; font: inherit; text-align: left; }
.ms-sum { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.ms-ph { color: var(--text-muted); }
.ms-chip { background: #efefed; border-radius: 99px; padding: 1px 9px; font-size: 12px; white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.ms-chip.more { background: var(--accent); color: #fff; }
.ms-caret { color: var(--text-muted); }
.ms-panel { position: absolute; z-index: 60; left: 0; right: 0; min-width: 240px; margin-top: 4px; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.15); }
.ms-panel[hidden] { display: none; }
.ms-head { padding: 8px 8px 4px; border-bottom: 1px solid #eee; }
.ms-search { width: 100%; box-sizing: border-box; padding: 6px 9px; border: 1px solid var(--border); border-radius: 6px; font: inherit; margin-bottom: 4px; }
.ms-acts { font-size: 12px; }
.ms-list { max-height: 230px; overflow: auto; padding: 4px 8px 8px; }
.ms-list label { display: flex !important; flex-direction: row !important; align-items: center; gap: 8px; padding: 4px 2px; font-weight: 400 !important; font-size: 13px; cursor: pointer; }
.ms-list label:hover { background: #f6f5f2; }
.ms-list input[type=checkbox] { width: auto; margin: 0; }
.ms-host { display: block; }

/* ===== Rollen & Rechte ===== */
.rt-wrap { max-height: 75vh; overflow: auto; }
.rt-table th.rt-role { text-align: center; min-width: 110px; position: sticky; top: 0; background: #f6f5f2; z-index: 2; }
.rt-table th.rt-role small { font-weight: 400; color: var(--text-muted); }
.rt-name { min-width: 320px; }
.rt-group td { background: #eef0f1; font-weight: 700; }
.rt-cell { text-align: center; }
.rt-tag { font-size: 10px; border: 1px solid var(--border); border-radius: 99px; padding: 0 6px; color: var(--text-muted); margin-left: 6px; }
.rt-tag.on { background: #e1f5e6; border-color: #a9d8b5; color: #1a7f3c; }
.rt-actions { margin-top: 4px; }
.rt-preview { background: #fff2b8; border-bottom: 2px solid #e2aa13; padding: 8px 16px; font-weight: 600; display: flex; gap: 12px; align-items: center; }

/* ===== Arbeitsbericht ===== */
.rp-row { display: grid; grid-template-columns: 2fr 1fr 90px 90px 80px 40px; gap: 6px; margin: 6px 0; }
.rp-row.m { grid-template-columns: 110px 2fr 90px 80px 1fr 40px; }
.rp-row select, .rp-row input { padding: 7px 8px; border: 1px solid var(--border); border-radius: 8px; font: inherit; min-width: 0; }
.rp-thumbs { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.rp-thumbs img { width: 48px; height: 48px; object-fit: cover; border-radius: 4px; }
.rp-thumbs.big img { width: 110px; height: 80px; }
.rp-thumb { display: grid; gap: 2px; font-size: 11px; }
.sig-pad { position: relative; border: 1px dashed #999; border-radius: 8px; background: #fff; max-width: 520px; touch-action: none; }
.sig-pad canvas { display: block; }
.sig-pad .sig-clear { position: absolute; top: 4px; right: 4px; padding: 3px 8px; font-size: 12px; }

/* Untermenü (zum Beispiel Lager) */
.nav-sub { display: flex; flex-direction: column; gap: 1px; margin: 0 0 6px 10px; padding-left: 8px; border-left: 1px solid rgba(239, 239, 237, 0.15); }
.nav-sublink { font-size: 13px; padding-top: 6px; padding-bottom: 6px; }

/* Startseite */
.start-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.start-hello { margin: 0; font-size: 28px; }
.start-shortcuts { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.start-shortcut { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 14px; }
.start-shortcut:hover { border-color: var(--accent); }
.start-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 16px; }
.start-widget { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; }
.start-wide { grid-column: 1 / -1; }
.start-widget header { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.start-widget h2 { margin: 0; font-size: 16px; }
.start-summary { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.start-empty { color: var(--text-muted); margin: 6px 0; font-size: 14px; }
.start-rows { list-style: none; margin: 0; padding: 0; }
.start-rows li { border-bottom: 1px solid #ece9e3; }
.start-rows li:last-child { border-bottom: 0; }
.start-rows li > a, .start-rows li > .start-row-text { display: block; padding: 8px 0 8px 12px; color: var(--text); text-decoration: none; border-left: 3px solid transparent; }
.start-rows li.tone-bad > a { border-left-color: #dc2626; }
.start-rows li.tone-warn > a { border-left-color: #f59e0b; }
.start-row-text { display: block; font-size: 14px; font-weight: 600; }
.start-row-sub { display: block; font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.start-more { margin-top: auto; padding-top: 10px; font-size: 13px; color: var(--accent-dark); text-decoration: none; }
.start-numbers { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.start-numbers a { display: flex; flex-direction: column; text-decoration: none; color: var(--text); }
.start-numbers b { font-size: 28px; }
.start-numbers span { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.start-sort { list-style: none; margin: 0; padding: 0; max-width: 520px; }
.start-sort li { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid #ece9e3; }
.start-sort label { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.start-arrows button { border: 1px solid var(--border); background: var(--surface); border-radius: 6px; padding: 2px 8px; cursor: pointer; margin-left: 4px; }
.start-shortcut-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.start-pick { display: flex; gap: 10px; align-items: center; cursor: pointer; }
@media (max-width: 700px) { .start-grid { grid-template-columns: 1fr; } .start-hello { font-size: 22px; } }

/* Aufgaben: Betreff, großes Textfeld, Fotos */
.task-form .full { margin-bottom: 16px; }
.task-form textarea.task-notes,
.form textarea.task-notes {
  width: 100%;
  box-sizing: border-box;
  min-height: 150px;
  line-height: 1.5;
  resize: vertical;
}
.task-form .form-grid { margin-bottom: 16px; }
a.task-title { color: inherit; text-decoration: none; display: inline-block; }
a.task-title:hover { text-decoration: underline; }
.task-notes-preview { font-size: 13px; color: var(--text-muted); margin-top: 3px; white-space: pre-line; overflow-wrap: anywhere; }
.task-thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.task-thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); display: block; }
.task-prio-hoch { color: var(--danger); font-weight: 600; }
.task-meta { flex-wrap: wrap; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.task-photo-edit { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 10px; }
.task-photo { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.task-photo img { width: 120px; height: 120px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); display: block; }
.task-detail-actions { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.task-detail-actions form { margin: 0; }

/* Große Textfelder in den Reitern am Auftrag (Notiz, Lieferumfang, Mängel …) */
.record-form textarea { min-height: 140px; resize: vertical; width: 100%; box-sizing: border-box; line-height: 1.5; }
/* Formular ohne eigenen Rahmen (zum Beispiel unter einer Tabelle im Reiter) */
.form.form-plain { background: none; border: 0; padding: 0; max-width: 900px; }
/* Felder mit der Klasse „full“ gehen im Formular über die ganze Breite */
.form-grid > .full { grid-column: 1 / -1; }
