@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --accent: #1a5aa6;
  --ink: #10243a;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: #eef1f4;
  height: 100%;
}

body {
  font-family: Barlow, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
  color: #10243a;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: #0f3f78;
  text-decoration: underline;
}

input,
select,
button {
  font-family: inherit;
}

::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}
::-webkit-scrollbar-thumb {
  background: #c3ccd6;
  border-radius: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}

.mono {
  font-family: 'IBM Plex Mono', monospace;
}

/* ── App shell ───────────────────────────────────────────── */

.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #eef1f4;
  color: #10243a;
  overflow: hidden;
}

/* ── Header ──────────────────────────────────────────────── */

.app-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 22px;
  background: var(--ink);
  color: #fff;
  flex: none;
}

.app-header__menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-left: auto;
  border: 1px solid #34506d;
  border-radius: 3px;
  background: transparent;
  color: #b9c9d8;
  cursor: pointer;
  flex: none;
}
.app-header__menu-toggle:hover {
  color: #fff;
  border-color: #4a6d8f;
}

.app-header__menu {
  display: contents;
}

.app-header__brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.app-header__logo {
  width: 30px;
  height: 30px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 17px;
  border-radius: 3px;
}

.app-header__title {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.app-header__export {
  font-size: 11px;
  color: #8fa6bd;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.tab-btn {
  padding: 7px 15px;
  border: 1px solid;
  border-radius: 3px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  background: transparent;
  border-color: #34506d;
  color: #b9c9d8;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tab-btn:hover {
  text-decoration: none;
}
.tab-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.tab-btn__count {
  font-family: 'IBM Plex Mono', monospace;
  opacity: 0.65;
}

.tab-btn--add {
  margin-left: 6px;
  border-style: dashed;
  border-color: var(--accent);
  color: var(--accent);
}
.tab-btn--add:hover {
  background: var(--accent);
  border-style: solid;
  color: #fff;
}

/* ── KPI strip ───────────────────────────────────────────── */

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: #d9e0e7;
  flex: none;
  border-bottom: 1px solid #d9e0e7;
}

.kpi {
  background: #fff;
  padding: 12px 18px 13px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kpi__label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #7d8b9a;
}

.kpi__row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.kpi__value {
  font-size: 26px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
}

.kpi__sub {
  font-size: 12px;
  color: #64748b;
}

.kpi__bars {
  display: flex;
  gap: 3px;
  height: 5px;
  margin-top: 1px;
}

.kpi__bar {
  height: 5px;
  border-radius: 3px;
}

/* ── Filter bar ──────────────────────────────────────────── */

.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  row-gap: 8px;
  padding: 10px 18px;
  background: #f7f9fa;
  border-bottom: 1px solid #dde4ea;
  flex: none;
}

.filter-bar__search {
  flex: 1 1 200px;
  min-width: 160px;
  max-width: 280px;
  padding: 7px 10px;
  border: 1px solid #cfd8e0;
  border-radius: 3px;
  font-size: 13px;
  background: #fff;
  color: #10243a;
}

.filter-bar__select {
  flex: 0 1 220px;
  min-width: 150px;
  padding: 7px 10px;
  border: 1px solid #cfd8e0;
  border-radius: 3px;
  font-size: 13px;
  background: #fff;
  color: #10243a;
}

.chip-group {
  display: flex;
  gap: 4px;
}

.chip {
  padding: 6px 12px;
  font-size: 12.5px;
  border: 1px solid #cfd8e0;
  border-radius: 3px;
  cursor: pointer;
  background: #fff;
  color: #32475c;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip:hover {
  text-decoration: none;
}
.chip.is-active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
.chip__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.filter-bar__end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-bar__result {
  font-size: 12px;
  color: #64748b;
}

.btn-outline {
  padding: 6px 12px;
  font-size: 12.5px;
  border: 1px solid #cfd8e0;
  border-radius: 3px;
  cursor: pointer;
  background: #fff;
  color: #10243a;
  text-decoration: none;
}
.btn-outline:hover {
  text-decoration: none;
}

.btn-outline--danger {
  color: #b3452f;
  border-color: #e3c4ba;
}
.btn-outline--danger:hover {
  background: #fbeee9;
  border-color: #b3452f;
}

.btn-ghost {
  padding: 6px 12px;
  font-size: 12.5px;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  background: transparent;
  color: #7d8b9a;
}

.btn-primary {
  padding: 6px 12px;
  font-size: 12.5px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
}

/* ── Board (columns) ─────────────────────────────────────── */

.board {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 10px;
  padding: 12px 18px 18px;
  overflow-x: auto;
  align-items: stretch;
}

.column {
  flex: 1 0 236px;
  min-width: 236px;
  display: flex;
  flex-direction: column;
  background: #f7f9fa;
  border: 1px solid #dde4ea;
  border-radius: 4px;
  min-height: 0;
  transition: background-color 0.1s ease, border-color 0.1s ease;
}
.column.is-drop-target {
  background: #e6eef7;
  border-color: var(--accent);
}

.column__header {
  padding: 10px 12px 9px;
  border-bottom: 1px solid #e3e9ee;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: none;
}

.column__title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.column__accent {
  width: 3px;
  height: 14px;
  border-radius: 2px;
}

.column__label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.column__count {
  margin-left: auto;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: #64748b;
}

.column__sum {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  color: #8494a3;
  padding-left: 11px;
}

.column__body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.column__empty {
  border: 1px dashed #cfd8e0;
  border-radius: 3px;
  padding: 14px 10px;
  text-align: center;
  font-size: 11.5px;
  color: #9aa8b5;
}

/* ── Card ────────────────────────────────────────────────── */

.card {
  background: var(--category-bg, #fff);
  border: 1px solid #dde4ea;
  border-left: 3px solid var(--flag-color, #2f7d5b);
  border-radius: 3px;
  padding: 9px 10px;
  cursor: grab;
  box-shadow: 0 1px 1px rgba(16, 36, 58, 0.04);
  display: block;
  text-decoration: none;
  color: inherit;
}
.card:hover {
  border-color: #a9bccd;
  box-shadow: 0 2px 6px rgba(16, 36, 58, 0.09);
  text-decoration: none;
  color: inherit;
}
.card.is-dragging {
  opacity: 0.4;
}

.card__top {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 4px;
}

.card__nr {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: #8494a3;
  letter-spacing: 0.02em;
}

.card__due {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
}

.card__avatar {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  color: #fff;
  font-size: 9px;
  font-weight: 600;
  display: grid;
  place-items: center;
  letter-spacing: 0.02em;
  flex: none;
  margin-left: auto;
}

.card__name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  text-wrap: pretty;
  margin-bottom: 3px;
}

.card__kunde {
  font-size: 11.5px;
  color: #64748b;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card__detail {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.card__bar-track {
  height: 4px;
  background: #e7ecf1;
  border-radius: 3px;
  overflow: hidden;
  display: flex;
}

.card__bar-fill {
  height: 4px;
}

.card__stats {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: #64748b;
}

.card__stats-hours {
  color: #10243a;
}

.card__stats-right {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-left: auto;
}

.card__tasks-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  color: #8494a3;
  flex: none;
}

.card__tasks-icon {
  flex: none;
}

/* ── Maintenance table ───────────────────────────────────── */

.maint-main {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 18px 20px;
}

.maint-table {
  background: #fff;
  border: 1px solid #dde4ea;
  border-radius: 4px;
  overflow: hidden;
}

.maint-row,
.maint-table__head {
  display: grid;
  grid-template-columns: 92px 1fr 1.1fr 118px 96px 96px 72px 84px;
  gap: 12px;
  padding: 9px 14px;
}

.maint-table__head {
  background: #f7f9fa;
  border-bottom: 1px solid #dde4ea;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7d8b9a;
}

.maint-row {
  border-bottom: 1px solid #eef2f5;
  font-size: 12.5px;
  cursor: pointer;
  align-items: center;
  text-decoration: none;
  color: inherit;
}
.maint-row:hover {
  background: #f7f9fa;
  text-decoration: none;
  color: inherit;
}

.maint-row__nr {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: #8494a3;
}
.maint-row__name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.maint-row__kunde {
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.maint-row__label {
  font-size: 11px;
  color: #64748b;
}
.maint-row__hours {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
}
.maint-row__chf {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  color: #64748b;
}
.maint-row__tasks {
  font-size: 11.5px;
  color: #64748b;
}
.maint-row__pl {
  font-size: 11.5px;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: #8494a3;
  font-size: 13px;
}

/* ── Turbo frames ────────────────────────────────────────── */
/* turbo-frame has no default display, so it doesn't inherit flex-item
   sizing on its own — without this, .board / .maint-main never get
   height-constrained and each column grows to fit its content instead
   of scrolling internally. */

turbo-frame#board-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Its content (.detail-overlay) is position:fixed, so the frame itself
   doesn't need to participate in the app's flex layout at all. */
turbo-frame#detail {
  display: contents;
}
turbo-frame#detail:empty {
  display: none;
}

/* ── Detail panel (shown as a centered modal) ──────────────── */

.detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(4, 9, 16, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.detail {
  width: min(720px, 100%);
  max-height: 100%;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 20px 48px rgba(16, 36, 58, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.detail__header {
  padding: 16px 20px 14px;
  border-bottom: 1px solid #e3e9ee;
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex: none;
}

.detail__meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.detail__nr {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: #8494a3;
}

.detail__flag {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: #64748b;
}

.detail__flag-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.detail__close {
  border: 1px solid #dde4ea;
  background: #fff;
  border-radius: 3px;
  width: 26px;
  height: 26px;
  cursor: pointer;
  color: #64748b;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.detail__close:hover {
  text-decoration: none;
  color: #64748b;
}

.detail__menu {
  position: relative;
  margin-left: auto;
}

.detail__menu-btn {
  border: 1px solid #dde4ea;
  background: #fff;
  border-radius: 3px;
  width: 26px;
  height: 26px;
  cursor: pointer;
  color: #64748b;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.detail__menu-btn:hover {
  color: #10243a;
  border-color: #c3ccd6;
}

.detail__menu-panel {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 30;
  min-width: 180px;
  background: #fff;
  border: 1px solid #cfd8e0;
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(16, 36, 58, 0.16);
  padding: 4px;
  flex-direction: column;
  gap: 2px;
}
.detail__menu-panel[hidden] {
  display: none;
}
.detail__menu-panel:not([hidden]) {
  display: flex;
}

.detail__menu-item {
  display: block;
  width: 100%;
  text-align: left;
  text-decoration: none;
  border: none;
  background: none;
  padding: 7px 9px;
  font-size: 12.5px;
  color: #10243a;
  border-radius: 3px;
  cursor: pointer;
}
.detail__menu-item:hover {
  background: #f2f5f8;
}
.detail__menu-item--danger {
  color: #b3452f;
}

.detail__menu-divider {
  height: 1px;
  background: #e3e9ee;
  margin: 3px 1px;
}

.detail__menu-label {
  font-size: 9.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #8494a3;
  padding: 4px 9px 2px;
}

.detail__menu-statuses {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 2px 9px 6px;
}

.detail__menu-swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--swatch-color, #cfd8e0);
  cursor: pointer;
  padding: 0;
}
.detail__menu-swatch.is-active {
  border-color: #10243a;
}
.detail__menu-swatch--auto {
  background: #fff;
  border: 1px solid #cfd8e0;
  color: #64748b;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.detail__name {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.25;
  text-wrap: pretty;
}

.detail__kunde {
  font-size: 13px;
  color: #64748b;
}

.detail__body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.detail__facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: #e3e9ee;
  border: 1px solid #e3e9ee;
  border-radius: 3px;
}

.detail__fact {
  background: #fff;
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.detail__fact-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #8494a3;
}

.detail__fact-value {
  font-size: 14px;
  font-weight: 500;
}

.detail__section {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.detail__section-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #8494a3;
}

.detail__phases {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.detail__section-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.detail__section--assignee {
  align-items: flex-end;
}

.phase-btn {
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid #cfd8e0;
  border-radius: 3px;
  cursor: pointer;
  background: #fff;
  color: #32475c;
}
.phase-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.detail__text {
  font-size: 12.5px;
  line-height: 1.5;
  color: #32475c;
  white-space: pre-wrap;
  text-wrap: pretty;
}

.detail__description {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail__description-content {
  max-height: 6.6em;
  overflow: hidden;
}

.detail__description.is-expanded .detail__description-content {
  max-height: none;
}

.detail__description-toggle {
  align-self: flex-start;
  border: none;
  background: none;
  padding: 0;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
}

.detail__description-toggle:hover {
  text-decoration: underline;
}

.markdown-body {
  font-size: 12.5px;
  line-height: 1.5;
  color: #32475c;
}

.markdown-body > *:first-child {
  margin-top: 0;
}

.markdown-body > *:last-child {
  margin-bottom: 0;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body blockquote,
.markdown-body pre {
  margin: 0 0 8px;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 20px;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  margin: 12px 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: #1c2b3a;
}

.markdown-body a {
  color: var(--accent);
}

.markdown-body code {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  background: #eef2f6;
  padding: 1px 4px;
  border-radius: 3px;
}

.markdown-body blockquote {
  padding-left: 10px;
  border-left: 2px solid #d6dee6;
  color: #5b6b7a;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-field label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #8494a3;
}

.form-field input[type="text"],
.form-field input[type="number"],
.form-field select,
.form-field textarea {
  padding: 7px 10px;
  border: 1px solid #cfd8e0;
  border-radius: 3px;
  font-size: 13px;
  background: #fff;
  color: #10243a;
  width: 100%;
}

.form-field textarea {
  font-family: inherit;
  resize: vertical;
}

.form-field-row {
  display: flex;
  gap: 10px;
}
.form-field-row .form-field {
  flex: 1;
  min-width: 0;
}

.form-field--checkbox {
  flex-direction: row;
  align-items: center;
  gap: 7px;
}
.form-field--checkbox label {
  text-transform: none;
  letter-spacing: normal;
  font-size: 13px;
  color: #32475c;
}

.category-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}
.category-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #32475c;
  cursor: pointer;
}

.new-project__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

/* ── Compact mode (via ?dense=1) ─────────────────────────── */

.board.is-dense .card__detail {
  display: none;
}

@media (max-width: 720px) {
  .detail-overlay {
    padding: 0;
  }
  .detail {
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }
}

/* ── Header: hamburger nav (mobile) ─────────────────────────── */

@media (max-width: 780px) {
  .app-header__menu-toggle {
    display: inline-flex;
  }

  .app-header__menu {
    display: none;
  }
  .app-header__menu:not([hidden]) {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 40;
    padding: 12px 16px 18px;
    background: var(--ink);
    box-shadow: 0 10px 24px rgba(4, 9, 16, 0.35);
  }

  .app-header__menu .tabs {
    flex-direction: column;
    margin-left: 0;
    gap: 6px;
    width: 100%;
  }
  .app-header__menu .tab-btn {
    width: 100%;
  }

  .app-header__menu .app-header__user {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: 100%;
  }
}

/* ── Project tasks (in the detail panel) ─────────────────── */

.tasks {
  gap: 10px;
}

.tasks__header-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.tasks__count {
  font-size: 11px;
  color: #64748b;
}

.tasks__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.tasks__search {
  flex: 1 1 200px;
  max-width: none;
}

.tasks__status-chips {
  flex-wrap: wrap;
}

.tasks__archived-toggle {
  align-self: flex-start;
}

.tasks__empty {
  font-size: 12.5px;
  color: #8494a3;
  padding: 8px 0;
}

.tasks__list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.task-row {
  border: 1px solid #e3e9ee;
  border-radius: 4px;
  background: #fff;
}

.task-row__summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
}
.task-row__summary::-webkit-details-marker {
  display: none;
}
.task-row__summary::marker {
  content: '';
}

.task-row__checkbox {
  width: 15px;
  height: 15px;
  flex: none;
  padding: 0;
  border: 1.5px solid #c3ccd6;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
}
.task-row__checkbox:hover {
  border-color: #8494a3;
}
.task-row__checkbox.is-checked {
  background: #2f7d5b url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 8.3l2.5 2.5L12 5'/%3E%3C/svg%3E") center / 11px no-repeat;
  border-color: #2f7d5b;
}

.task-status-tag {
  font-size: 9.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  flex: none;
  background: #eef1f4;
  color: #64748b;
}
.task-status-tag--in_arbeit {
  background: #e4edf7;
  color: #1a5aa6;
}
.task-status-tag--in_review {
  background: #fbeee0;
  color: #b07d17;
}
.task-status-tag--done {
  background: #e3f0e8;
  color: #2f7d5b;
}
.task-status-tag--archiviert {
  background: #eceef0;
  color: #8494a3;
}

.task-row__title {
  flex: 1;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-row__desc-icon {
  font-size: 13px;
  line-height: 1;
  color: #a8b4c0;
}

.task-row__comment-count {
  font-size: 11px;
  color: #8494a3;
}

.task-row__due {
  font-size: 10.5px;
  color: #8494a3;
}

.task-row__due-wrap {
  position: relative;
  flex: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
}
.task-row__due-wrap:hover {
  background: #eef1f4;
}
.task-row__due-wrap.is-empty {
  opacity: 0;
}
.task-row:hover .task-row__due-wrap.is-empty,
.task-row__due-wrap.is-empty:focus-within {
  opacity: 1;
}
.task-row__due-input {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.task-row__project {
  flex: none;
  font-size: 11px;
  color: #64748b;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-row__title-form {
  flex: 1;
  display: flex;
}
.task-row__modal-title-input {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 3px 6px;
  margin-left: -6px;
  font-family: inherit;
  background: transparent;
}
.task-row__modal-title-input:hover {
  border-color: #dde4ea;
}
.task-row__modal-title-input:focus {
  border-color: var(--accent);
  outline: none;
  background: #fff;
}

.task-row__avatar {
  width: 19px;
  height: 19px;
  font-size: 9px;
  flex: none;
}
.task-row__avatar--none {
  opacity: 0;
}
.task-row:hover .task-row__avatar--none {
  opacity: 0.6;
}

.task-row__body {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(4, 9, 16, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.task-row__modal {
  width: min(640px, 100%);
  max-height: 100%;
  overflow-y: auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 20px 48px rgba(16, 36, 58, 0.28);
  padding: 18px 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.task-row__modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.task-row__modal-title {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  color: #10243a;
}

.task-row__modal-close {
  border: 1px solid #dde4ea;
  background: #fff;
  border-radius: 3px;
  width: 26px;
  height: 26px;
  cursor: pointer;
  color: #64748b;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.task-row__modal-close:hover {
  color: #10243a;
}

.task-row__danger-zone {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
  border-top: 1px solid #eef1f4;
}

.tasks__assignees {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.avatar-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #fff;
  font-size: 9.5px;
  font-weight: 600;
  display: grid;
  place-items: center;
  border: 2px solid transparent;
  cursor: pointer;
}
.avatar-btn.is-active {
  border-color: var(--ink);
}
.avatar-btn--none {
  background: #e3e9ee !important;
  color: #8494a3;
}

.tasks__due-form {
  display: flex;
  gap: 6px;
}
.tasks__due-form .filter-bar__search {
  max-width: 160px;
}

.tasks__edit-description-toggle {
  cursor: pointer;
  font-size: 11.5px;
  color: var(--accent);
  margin-top: 4px;
}

.tasks__description-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.tasks__description-input {
  padding: 7px 9px;
  border: 1px solid #cfd8e0;
  border-radius: 3px;
  font-size: 12.5px;
  font-family: inherit;
  resize: vertical;
}

.tasks__comments {
  gap: 8px;
}

.task-comment {
  border-top: 1px solid #eef1f4;
  padding-top: 8px;
  font-size: 12px;
}

.task-comment__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #64748b;
  font-size: 11px;
  margin-bottom: 3px;
}

.task-comment__avatar {
  width: 17px;
  height: 17px;
  font-size: 8.5px;
}

.task-comment__body {
  color: #32475c;
  line-height: 1.45;
}

.task-comment-form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.task-comment-form__author {
  flex: 0 1 140px;
}

.task-comment-form input[type='text'] {
  flex: 1 1 140px;
  padding: 7px 9px;
  border: 1px solid #cfd8e0;
  border-radius: 3px;
  font-size: 12.5px;
}

.tasks__add-form {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}

.tasks__add-trigger {
  align-self: flex-start;
  margin-top: 6px;
  padding: 5px 8px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #64748b;
  font-size: 12.5px;
  cursor: pointer;
}
.tasks__add-trigger:hover {
  background: #eef1f4;
  color: var(--accent);
}
.tasks__add-trigger[hidden],
.tasks__add-form[hidden] {
  display: none;
}

.tasks__add-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26, 90, 166, 0.18);
}

.tasks__add-hint {
  font-size: 10px;
  color: #8494a3;
}

/* ── Filter controls (selects, dropdown, toggles) ─────────────── */

.filter-select {
  padding: 7px 28px 7px 10px;
  border: 1px solid #cfd8e0;
  border-radius: 3px;
  background: #fff;
  color: #32475c;
  font-size: 12.5px;
  cursor: pointer;
}
.filter-select.is-active {
  border-color: var(--accent);
  background-color: #e4edf7;
  color: var(--accent);
  font-weight: 600;
}
button.filter-select {
  padding-right: 10px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: #32475c;
  cursor: pointer;
  user-select: none;
}
.toggle input {
  accent-color: var(--accent);
  cursor: pointer;
}

.dropdown {
  position: relative;
}
.dropdown__panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 20;
  min-width: 190px;
  padding: 6px;
  background: #fff;
  border: 1px solid #cfd8e0;
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(16, 36, 58, 0.16);
}
.dropdown__panel[hidden] {
  display: none;
}
.dropdown__option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 3px;
  font-size: 12.5px;
  cursor: pointer;
}
.dropdown__option:hover {
  background: #eef1f4;
}
.dropdown__all {
  width: 100%;
  border: 0;
  background: none;
  color: var(--accent);
  font-family: inherit;
  font-weight: 600;
  text-align: left;
}

.tasks__add-input {
  flex: none;
  max-width: none;
}

.tasks__loading {
  font-size: 12px;
  color: #8494a3;
  padding: 6px 0;
}

/* ── Tasks overview (all tasks, grouped by project) ─────────── */

turbo-frame#tasks-overview-results {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.tasks-overview {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.tasks-overview > * {
  width: 100%;
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
  flex: none;
}

.tasks-overview__toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  background: #fff;
  border: 1px solid #dde4ea;
  border-radius: 4px;
  padding: 10px 14px;
  position: sticky;
  top: 0;
  z-index: 15;
  box-shadow: 0 2px 8px rgba(16, 36, 58, 0.06);
}

@media (max-width: 780px) {
  .tasks-overview__toolbar {
    position: static;
  }

  .tasks-overview {
    padding: 10px 8px 20px;
  }
  /* Doubled selector: the base group rule is defined further down. */
  .tasks-overview .tasks-overview__group {
    padding: 10px 8px;
  }

  /* Task title wins over project: let it wrap (up to 3 lines) and push the
     project name onto its own line below instead of squeezing the title. */
  .task-row__summary {
    flex-wrap: wrap;
    padding: 8px;
    row-gap: 2px;
  }
  .task-row__title {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
  }
  .task-row__project {
    order: 1;
    flex: 1 1 100%;
    max-width: none;
    padding-left: 23px;
  }
}

.tasks-overview__search {
  flex: 1 1 200px;
  max-width: 300px;
}

.tasks-overview__count {
  margin-left: auto;
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
}

.tasks-overview__group {
  --group-color: #cfd8e0;
  background: #fff;
  border: 1px solid #dde4ea;
  border-left: 4px solid var(--group-color);
  border-radius: 4px;
  padding: 12px 14px;
}

.tasks-overview__group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  margin-bottom: 6px;
  border-bottom: 1px solid #eef1f4;
}
.tasks-overview__group.is-collapsed .tasks-overview__group-header {
  border-bottom-color: transparent;
  padding-bottom: 0;
  margin-bottom: 0;
}

.tasks-overview__collapse {
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: transform 0.15s;
}
.tasks-overview__collapse:hover {
  background: #eef1f4;
  color: #10243a;
}
.tasks-overview__group.is-collapsed .tasks-overview__collapse {
  transform: rotate(-90deg);
}

.tasks-overview__group-link {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}
a.tasks-overview__group-link:hover {
  text-decoration: none;
}
a.tasks-overview__group-link:hover .tasks-overview__project-name {
  color: var(--accent);
}

.tasks-overview__progress {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tasks-overview__progress-label {
  font-size: 10.5px;
  color: #64748b;
}
.tasks-overview__progress-bar {
  width: 70px;
  height: 4px;
  border-radius: 2px;
  background: #e3e9ee;
  overflow: hidden;
}
.tasks-overview__progress-bar > span {
  display: block;
  height: 100%;
  background: #2f7d5b;
}
.tasks-overview__project-nr {
  font-size: 11px;
  color: #8494a3;
}

.tasks-overview__project-name {
  font-size: 14.5px;
  font-weight: 600;
  color: #10243a;
}

.tasks-overview__project-kunde {
  font-size: 12px;
  color: #64748b;
  margin-left: auto;
}

/* ── Header: user area ──────────────────────────────────────── */

.app-header__user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-header__user-name {
  font-size: 12.5px;
  color: #b9c9d8;
}

.app-header__user .btn-outline {
  background: transparent;
  border-color: #34506d;
  color: #b9c9d8;
}
.app-header__user .btn-outline:hover {
  color: #fff;
  border-color: #4a6d8f;
}

/* ── Login page ──────────────────────────────────────────────── */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #eef1f4;
}

.login-card {
  width: 320px;
  background: #fff;
  border: 1px solid #d9e0e7;
  border-radius: 6px;
  padding: 28px 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-card__brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-card__error {
  font-size: 12.5px;
  color: #b3452f;
  background: #fbebe7;
  border: 1px solid #f0cfc5;
  border-radius: 3px;
  padding: 8px 10px;
}

.login-card__form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-card__label {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7d8b9a;
  margin-top: 8px;
}

.login-card__form .filter-bar__search {
  flex: none;
  max-width: none;
  width: 100%;
}

.login-card__remember {
  margin-top: 10px;
}

.login-card__submit {
  margin-top: 14px;
  text-align: center;
}

/* ── Floating "Neuer Task" button + modal ────────────────── */

.fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.fab:hover {
  filter: brightness(1.1);
}

.fab__plus {
  font-size: 18px;
  line-height: 1;
}

.fab__key {
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 11px;
}

.modal {
  width: min(520px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 6px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.modal::backdrop {
  background: rgba(20, 30, 40, 0.45);
}

.modal__form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 20px;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal__title {
  margin: 0;
  font-size: 16px;
}

.modal .form-field textarea,
.modal .form-field select {
  width: 100%;
}

.flash {
  margin: 10px 18px 0;
  padding: 8px 12px;
  border-radius: 3px;
  font-size: 12.5px;
}

.flash--error {
  background: #fdecea;
  color: #a12622;
}

@media (max-width: 780px) {
  .fab__label,
  .fab__key {
    display: none;
  }
}

/* Attachments: picker in forms, thumbnail gallery, lightbox */
.att-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  width: 100%;
}

.att-picker__button {
  padding: 4px 8px;
  border: 1px dashed #b7c4d0;
  border-radius: 3px;
  background: #fff;
  color: #32475c;
  font-size: 12px;
  cursor: pointer;
}

.att-picker__button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.att-picker__hint {
  color: #8696a6;
  font-size: 10.5px;
}

.att-picker__error {
  flex: 1 0 100%;
  color: #a12622;
  font-size: 12px;
}

form.is-dragging {
  outline: 2px dashed var(--accent);
  outline-offset: 4px;
}

.att-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.att-gallery--pending {
  flex: 1 0 100%;
  margin-top: 0;
}

.att-gallery--pending:empty {
  display: none;
}

.att-item {
  position: relative;
  display: inline-flex;
}

.att-item--uploading {
  opacity: 0.6;
}

.att-thumb {
  display: block;
  width: 96px;
  height: 72px;
  border: 1px solid #cfd8e0;
  border-radius: 3px;
  overflow: hidden;
  background: #f4f6f8;
  cursor: zoom-in;
}

.att-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.att-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 260px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid #cfd8e0;
  border-radius: 3px;
  background: #fff;
  color: #32475c;
  font-size: 12px;
}

.att-file:hover {
  text-decoration: none;
  border-color: var(--accent);
}

.att-file__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.att-file__size {
  color: #8696a6;
  font-size: 10.5px;
  white-space: nowrap;
}

.att-item__remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #10243a;
  color: #fff;
  font-size: 13px;
  line-height: 18px;
  cursor: pointer;
  opacity: 0;
}

.att-item:hover .att-item__remove,
.att-item__remove:focus-visible {
  opacity: 1;
}

@media (hover: none) {
  .att-item__remove {
    opacity: 1;
  }
}

.lightbox {
  max-width: 100vw;
  max-height: 100vh;
  width: 100vw;
  height: 100vh;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: hidden;
}

.lightbox::backdrop {
  background: rgba(10, 16, 24, 0.88);
}

.lightbox[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox__img {
  max-width: 92vw;
  max-height: 86vh;
  object-fit: contain;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  background: #fff;
}

.lightbox__close,
.lightbox__nav {
  position: absolute;
  border: 0;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
}

.lightbox__close {
  top: 16px;
  right: 16px;
  width: 38px;
  height: 38px;
  font-size: 24px;
}

.lightbox__nav {
  top: 50%;
  width: 44px;
  height: 44px;
  margin-top: -22px;
  font-size: 30px;
}

.lightbox__nav--prev {
  left: 16px;
}

.lightbox__nav--next {
  right: 16px;
}

.lightbox__close:hover,
.lightbox__nav:hover {
  background: rgba(255, 255, 255, 0.3);
}

.lightbox__caption {
  position: absolute;
  bottom: 14px;
  left: 0;
  right: 0;
  text-align: center;
  color: #c8d3de;
  font-size: 12px;
}

.lightbox__caption a {
  color: #fff;
}
