/* ==========================================================================
   Henkelmann · Reinigungsmanagement — Stylesheet
   ========================================================================== */

:root {
  color-scheme: light;

  /* Brand */
  --brand: #1baf7a;
  --brand-dark: #0f7a5c;
  --brand-50: #e6f7f0;
  --brand-100: #c6ecdc;

  /* Surfaces & ink (from validated palette) */
  --surface: #ffffff;
  --page: #f4f6f5;
  --ink: #0b0b0b;
  --ink-secondary: #52514e;
  --ink-muted: #898781;
  --border: rgba(11, 11, 11, 0.10);
  --border-strong: rgba(11, 11, 11, 0.16);
  --grid: #e1e0d9;

  /* Status (fixed, semantic — never reused for series identity) */
  --status-good: #0ca30c;
  --status-good-bg: #e5f6e5;
  --status-warning: #b8790a;
  --status-warning-bg: #fef2dc;
  --status-serious: #c85a34;
  --status-serious-bg: #fbe7de;
  --status-critical: #d03b3b;
  --status-critical-bg: #fbe2e2;
  --status-info: #2a78d6;
  --status-info-bg: #e6f0fc;
  --status-neutral: #6b6a66;
  --status-neutral-bg: #eeede9;

  /* Sidebar */
  --sidebar-bg: #0f221c;
  --sidebar-bg-2: #143026;
  --sidebar-ink: #eef4f1;
  --sidebar-ink-muted: #9fb9ae;
  --sidebar-active: #1c3d32;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(11,11,11,0.06);
  --shadow-md: 0 6px 20px rgba(11,11,11,0.08);
  --shadow-lg: 0 20px 45px rgba(11,11,11,0.16);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; }
p { margin: 0; }
button { font-family: inherit; }
.hidden { display: none !important; }

svg.icon { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; display: block; }

/* ==========================================================================
   Login screen
   ========================================================================== */

.login-screen {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  overflow: hidden;
}
.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 500px at 15% 10%, rgba(27,175,122,0.16), transparent 60%),
    radial-gradient(700px 500px at 90% 90%, rgba(15,34,28,0.10), transparent 60%),
    linear-gradient(180deg, #0f221c 0%, #163a2f 45%, #f4f6f5 45%);
  z-index: 0;
}
.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 36px 34px 28px;
  border: 1px solid var(--border);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-brand-name { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; }
.login-brand-sub { font-size: 12.5px; color: var(--ink-muted); }
.login-card h1 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.login-lead { color: var(--ink-secondary); font-size: 14px; margin-bottom: 22px; }

.field-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-secondary); margin: 14px 0 6px; }
.text-input, select.text-input, textarea.text-input {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.text-input:focus, select.text-input:focus, textarea.text-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-50);
}
textarea.text-input { resize: vertical; min-height: 84px; }

.role-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.role-option {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 14px 12px;
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, background .15s, transform .1s;
}
.role-option:hover { border-color: var(--brand); background: var(--brand-50); }
.role-option.active { border-color: var(--brand); background: var(--brand-50); box-shadow: 0 0 0 3px var(--brand-100); }
.role-option .role-icon {
  width: 32px; height: 32px; border-radius: 9px; background: var(--brand-50);
  display: flex; align-items: center; justify-content: center; color: var(--brand-dark);
}
.role-option.active .role-icon { background: var(--brand); color: #fff; }
.role-option-title { font-weight: 700; font-size: 13.5px; }
.role-option-desc { font-size: 11.5px; color: var(--ink-muted); line-height: 1.35; }

.login-demo { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--border-strong); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12px; color: var(--ink-muted); }
.chip-btn {
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink-secondary);
  border-radius: 999px; padding: 6px 12px; font-size: 12px; cursor: pointer; transition: all .15s;
}
.chip-btn:hover { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-50); }

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: filter .12s, background .12s, border-color .12s, transform .05s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-block { width: 100%; margin-top: 20px; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:disabled { background: var(--grid); color: var(--ink-muted); cursor: not-allowed; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--brand); color: var(--brand-dark); }
.btn-ghost { background: transparent; color: var(--ink-secondary); border-color: transparent; }
.btn-ghost:hover { background: var(--page); }
.btn-danger { background: var(--status-critical-bg); color: var(--status-critical); }
.btn-danger:hover { filter: brightness(0.96); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn svg.icon { width: 15px; height: 15px; }

/* ==========================================================================
   App shell
   ========================================================================== */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg-2));
  color: var(--sidebar-ink);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; font-weight: 800; font-size: 15.5px; letter-spacing: -0.01em; }
.sidebar-nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-ink-muted);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: var(--sidebar-ink); }
.nav-item.active { background: var(--sidebar-active); color: #fff; }
.nav-item.active svg.icon { color: var(--brand); }
.nav-item .nav-badge {
  margin-left: auto; background: var(--brand); color: #08221a; font-size: 10.5px; font-weight: 800;
  border-radius: 999px; padding: 1px 7px; line-height: 1.5;
}
.sidebar-spacer { flex: 1; }
.sidebar-user { border-top: 1px solid rgba(255,255,255,0.10); padding-top: 14px; display: flex; align-items: center; gap: 10px; }
.sidebar-avatar {
  width: 34px; height: 34px; border-radius: 999px; background: var(--brand); color: #06231a;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; flex-shrink: 0;
}
.sidebar-user-name { font-size: 13px; font-weight: 700; color: #fff; }
.sidebar-user-role { font-size: 11px; color: var(--sidebar-ink-muted); }
.sidebar-logout {
  margin-left: auto; background: transparent; border: none; color: var(--sidebar-ink-muted);
  cursor: pointer; padding: 6px; border-radius: 7px; display: flex;
}
.sidebar-logout:hover { color: #fff; background: rgba(255,255,255,0.08); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 26px 34px 18px;
}
.topbar h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }
.view-subtitle { font-size: 13.5px; color: var(--ink-muted); margin-top: 3px; }
.topbar-actions { display: flex; gap: 10px; flex-shrink: 0; }
.content { padding: 4px 34px 40px; flex: 1; }

/* ==========================================================================
   Stat tiles (KPI)
   ========================================================================== */

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat-tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.stat-tile-label { font-size: 12px; font-weight: 600; color: var(--ink-muted); display: flex; align-items: center; gap: 6px; }
.stat-tile-value { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; margin-top: 6px; }
.stat-tile-sub { font-size: 12px; color: var(--ink-secondary); margin-top: 4px; }
.stat-tile-sub.up { color: var(--status-good); }
.stat-tile-sub.warn { color: var(--status-warning); }

/* ==========================================================================
   Cards / sections
   ========================================================================== */

.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); padding: 22px 24px; margin-bottom: 20px;
}
.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.panel-header h2 { font-size: 15.5px; font-weight: 800; }
.panel-header .hint { font-size: 12px; color: var(--ink-muted); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }

.photo-drop {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-md);
  padding: 18px; text-align: center; cursor: pointer; color: var(--ink-muted);
  font-size: 12.5px; transition: border-color .15s, background .15s; margin-top: 4px;
}
.photo-drop:hover { border-color: var(--brand); background: var(--brand-50); }
.photo-preview-wrap { position: relative; display: inline-block; margin-top: 8px; }
.photo-preview { max-width: 100%; max-height: 160px; border-radius: var(--radius-sm); border: 1px solid var(--border); display: block; }
.photo-remove {
  position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; border-radius: 999px;
  background: var(--status-critical); color: #fff; border: 2px solid #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* ==========================================================================
   Badges
   ========================================================================== */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; padding: 3px 9px 3px 7px; border-radius: 999px;
  white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; flex-shrink: 0; }
.badge-good { background: var(--status-good-bg); color: var(--status-good); }
.badge-warning { background: var(--status-warning-bg); color: var(--status-warning); }
.badge-serious { background: var(--status-serious-bg); color: var(--status-serious); }
.badge-critical { background: var(--status-critical-bg); color: var(--status-critical); }
.badge-info { background: var(--status-info-bg); color: var(--status-info); }
.badge-neutral { background: var(--status-neutral-bg); color: var(--status-neutral); }

/* ==========================================================================
   Filters
   ========================================================================== */

.filter-row { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-tab {
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink-secondary);
  padding: 6px 13px; border-radius: 999px; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: all .12s;
}
.filter-tab:hover { border-color: var(--brand); }
.filter-tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.search-wrap { position: relative; margin-left: auto; }
.search-wrap svg.icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-muted); width: 15px; height: 15px; }
.search-input { padding-left: 32px; width: 220px; }

/* ==========================================================================
   Kanban board
   ========================================================================== */

.board { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; align-items: start; }
.board.board-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.board-col { background: rgba(11,11,11,0.02); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px; min-height: 120px; transition: background .12s, border-color .12s; }
.board-col.drag-over { background: var(--brand-50); border-color: var(--brand); }
.board-col-header { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 10px; }
.board-col-title { font-size: 12.5px; font-weight: 800; color: var(--ink-secondary); text-transform: uppercase; letter-spacing: .03em; }
.board-col-count { font-size: 11px; font-weight: 700; color: var(--ink-muted); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; }
.board-col-empty { font-size: 12px; color: var(--ink-muted); text-align: center; padding: 20px 6px; }

.kcard {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 12px 13px; margin-bottom: 10px; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: box-shadow .12s, border-color .12s, transform .08s;
}
.kcard:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); transform: translateY(-1px); }
.kcard.dragging { opacity: 0.4; }
.kcard-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.kcard-title { font-size: 13px; font-weight: 700; line-height: 1.3; }
.kcard-meta { font-size: 11.5px; color: var(--ink-muted); margin-bottom: 8px; display: flex; align-items: center; gap: 5px; }
.kcard-desc { font-size: 12px; color: var(--ink-secondary); line-height: 1.4; margin-bottom: 9px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kcard-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kcard-person { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-secondary); font-weight: 600; }
.kcard-avatar { width: 20px; height: 20px; border-radius: 999px; background: var(--brand-100); color: var(--brand-dark); font-size: 9.5px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kcard-thumb { width: 100%; height: 90px; object-fit: cover; border-radius: 8px; margin-bottom: 8px; border: 1px solid var(--border); }

/* ==========================================================================
   Lists (Meine Meldungen / row list)
   ========================================================================== */

.list-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 4px; border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--page); }
.list-row-thumb { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; border: 1px solid var(--border); flex-shrink: 0; background: var(--brand-50); display: flex; align-items: center; justify-content: center; color: var(--brand-dark); }
.list-row-main { min-width: 0; flex: 1; }
.list-row-title { font-size: 13.5px; font-weight: 700; }
.list-row-meta { font-size: 12px; color: var(--ink-muted); margin-top: 2px; }
.list-row-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.empty-state { text-align: center; padding: 46px 20px; color: var(--ink-muted); }
.empty-state svg.icon { width: 40px; height: 40px; margin: 0 auto 12px; color: var(--border-strong); }
.empty-state-title { font-weight: 700; color: var(--ink-secondary); font-size: 14px; margin-bottom: 4px; }
.empty-state-desc { font-size: 12.5px; max-width: 320px; margin: 0 auto; }

/* ==========================================================================
   Modal
   ========================================================================== */

.modal-overlay {
  position: fixed; inset: 0; background: rgba(10, 18, 15, 0.55);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 24px;
  backdrop-filter: blur(2px);
}
.modal-box {
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; padding: 26px 28px 24px;
}
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.modal-header h2 { font-size: 17px; font-weight: 800; }
.modal-close { background: var(--page); border: none; border-radius: 999px; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink-secondary); flex-shrink: 0; }
.modal-close:hover { background: var(--border-strong); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; margin-bottom: 16px; }
.detail-item-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-muted); margin-bottom: 3px; }
.detail-item-value { font-size: 13.5px; color: var(--ink); font-weight: 600; }
.detail-desc-box { background: var(--page); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13px; color: var(--ink-secondary); line-height: 1.5; margin-bottom: 16px; }
.modal-photo { width: 100%; max-height: 220px; object-fit: cover; border-radius: var(--radius-md); border: 1px solid var(--border); margin-bottom: 16px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 16px; border-top: 1px solid var(--border); }
.timeline { margin-top: 4px; }
.timeline-item { display: flex; gap: 10px; font-size: 12px; color: var(--ink-secondary); padding: 5px 0; }
.timeline-dot { width: 7px; height: 7px; border-radius: 999px; background: var(--brand); margin-top: 5px; flex-shrink: 0; }
.linked-project-box {
  background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: var(--radius-md);
  padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px;
}

/* ==========================================================================
   Toasts
   ========================================================================== */

.toast-container { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--ink); color: #fff; padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 9px;
  animation: toast-in .18s ease-out; max-width: 320px;
}
.toast-good { background: #0c3d0c; }
.toast-critical { background: #4a1414; }
.toast .dot { width: 8px; height: 8px; border-radius: 999px; background: var(--brand); flex-shrink: 0; }
.toast-good .dot { background: var(--status-good); }
.toast-critical .dot { background: var(--status-critical); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 980px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .board, .board.board-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; align-items: center; padding: 12px 14px; }
  .sidebar-brand { padding: 0; margin-right: 12px; }
  .sidebar-nav { flex-direction: row; overflow-x: auto; }
  .sidebar-spacer { display: none; }
  .sidebar-user { border-top: none; padding-top: 0; margin-left: 8px; }
  .sidebar-user-name, .sidebar-user-role { display: none; }
  .topbar { padding: 20px 18px 14px; flex-direction: column; align-items: stretch; }
  .content { padding: 4px 18px 32px; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .board, .board.board-3 { grid-template-columns: 1fr; }
  .role-picker { grid-template-columns: 1fr; }
}
