/* Task manager (web/tm/): colours, type and buttons come from /style.css, this file is only its layout. */
body.tm { overflow: hidden; }
.tm-app { height: 100dvh; display: flex; flex-direction: column; }
.tm-top {
  display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px; border-bottom: 1px solid var(--border);
}
.tm-top h1 { font-size: 1.1rem; margin: 0; }
.tm-top .btn { text-decoration: none; }
.tm-state { flex: 1; font-size: .82rem; color: var(--warn); text-align: right; min-width: 0; }
.tm-bereich { width: auto; max-width: 46vw; padding: .4em .7em; font-weight: 550; }

.tm-tabs { display: flex; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tm-tabs a {
  flex: none; padding: .45em .85em; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 550;
}
.tm-tabs a.active { background: var(--accent-soft); color: var(--accent); }

.tm-body { flex: 1; min-height: 0; display: flex; }
.tm-view { flex: 1; min-width: 0; overflow-y: auto; padding: 16px 16px calc(env(safe-area-inset-bottom, 0px) + 40px); }
.tm-view > * { max-width: 760px; margin-left: auto; margin-right: auto; }
.tm-detail {
  width: min(440px, 42vw); flex: none; overflow-y: auto; border-left: 1px solid var(--border); background: var(--surface);
  padding: 12px 16px calc(env(safe-area-inset-bottom, 0px) + 32px);
}

.tm-login { height: 100dvh; display: grid; place-items: center; padding: 16px; }
.tm-login-card { width: min(360px, 100%); text-align: center; }
.tm-login-card h1 { font-size: 1.6rem; }
.tm-person { padding: 10px 0; border-bottom: 1px solid var(--border); }
.tm-person-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tm-person-head b { flex: 1; min-width: 120px; }
.tm-person .tm-toggle { margin: 4px 12px 0 0; }
.tm-link { display: flex; gap: 6px; margin-top: 6px; }
.tm-link input { font-size: .82rem; padding: .4em .6em; }

/* quick add and filters */
.tm-quick {
  display: flex; align-items: center; gap: 8px; padding: 0 12px; margin-bottom: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; color: var(--muted);
}
.tm-quick:focus-within { outline: 2px solid var(--accent); outline-offset: -1px; }
.tm-quick input { border: 0; background: none; padding: .75em 0; }
.tm-quick input:focus { outline: none; }
.tm-filter { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.tm-filter input[type=search] { flex: 1 1 160px; padding: .45em .8em; }
.tm-filter select { width: auto; padding: .45em .7em; }
.tm-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: .92rem; color: var(--muted); white-space: nowrap; }
.tm-toggle input { width: auto; accent-color: var(--accent); }
.tm-actions { display: flex; justify-content: flex-end; margin-bottom: 4px; }

/* sections and rows */
.tm-section { margin: 18px auto 0; }
.tm-h { display: flex; align-items: center; gap: 8px; font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 6px; }
.tm-h a { color: inherit; }
.tm-count { font-weight: 500; opacity: .75; }
.tm-h-btn { margin-left: auto; text-transform: none; letter-spacing: 0; }
details.tm-section > summary { cursor: pointer; list-style: none; }
details.tm-section > summary::-webkit-details-marker { display: none; }
details.tm-section > summary .tm-h::after { content: "anzeigen"; margin-left: auto; font-weight: 500; text-transform: none; letter-spacing: 0; }
details.tm-section[open] > summary .tm-h::after { content: "ausblenden"; }

.tm-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; margin-bottom: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
}
.tm-row.active { border-color: var(--accent); }
/* the customer's colour: a stripe on the left and a breath of it in the background */
.tm-row[style*="--kf"], .tm-card[style*="--kf"] {
  border-left: 5px solid var(--kf); background: color-mix(in srgb, var(--kf) 7%, var(--surface));
}
.tm-wo[style*="--kf"]::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--kf); margin-right: 6px; }
.tm-review { display: flex; gap: 6px; flex: none; }
.tm-hint { margin: -2px 0 8px; }
.tm-farben { display: flex; flex-wrap: wrap; gap: 8px; }
.tm-farbe {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--border); background: var(--kf, var(--surface-2));
  color: var(--muted); font: inherit; font-size: .75rem; font-weight: 700; cursor: pointer; padding: 0;
}
.tm-farbe[aria-checked="true"] { outline: 3px solid var(--text); outline-offset: 2px; }
.tm-check {
  flex: none; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--muted); background: none;
  color: var(--accent-text); cursor: pointer; display: grid; place-items: center; padding: 0; position: relative;
}
.tm-check::after { content: ""; position: absolute; inset: -10px; }  /* a finger-sized target */
.tm-check:hover { border-color: var(--accent); }
.tm-check[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); }
.tm-check .ic { width: 14px; height: 14px; stroke-width: 3; }
.tm-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; color: inherit; text-decoration: none; }
.tm-title { font-weight: 550; overflow-wrap: anywhere; }
.tm-row.done .tm-title { text-decoration: line-through; color: var(--muted); font-weight: 400; }
.tm-meta { display: flex; flex-wrap: wrap; gap: 0 10px; font-size: .84rem; color: var(--muted); margin: 0; }
.tm-meta span:not(:last-child)::after { content: " ·"; }
.tm-late { color: var(--danger); font-weight: 550; }
.tm-view a:not(.tm-card):not(.tm-row-main):not(.btn), .tm-detail a { color: var(--accent); }
.tm-chip { flex: none; font-size: .76rem; font-weight: 600; padding: .15em .6em; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.tm-chip[data-status="heute"], .tm-chip[data-status="in_arbeit"] { background: var(--accent-soft); color: var(--accent); }
.tm-chip[data-status="wartet"] { background: var(--info-soft); color: var(--info); }
.tm-chip[data-status="freigabe"] { background: var(--act-soft); color: var(--act); }

.tm-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.tm-card {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; color: inherit; text-decoration: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
}
.tm-card:hover, .tm-row:hover { border-color: var(--accent); }
.tm-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.tm-head h2 { margin: 0 0 2px; }
.tm-head p { margin: 0; }
.tm-note { white-space: pre-wrap; color: var(--muted); margin: 0 auto 12px; }

/* task detail */
.tm-detail-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.tm-detail-head span { flex: 1; min-width: 0; }
.tm-detail-title { border: 0; background: none; font-size: 1.25rem; font-weight: 650; padding: .2em 0; resize: none; field-sizing: content; }
.tm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.tm-grid .wide { grid-column: 1 / -1; }
.tm-detail .field { margin: .45em 0; }
.tm-detail h3 { font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 1.1em 0 .4em; }
.tm-step { display: flex; align-items: center; gap: 8px; }
.tm-step input[type=checkbox] { width: 18px; height: 18px; flex: none; accent-color: var(--accent); }
.tm-step input[type=text] { border-color: transparent; background: none; padding: .35em .4em; }
.tm-step.done input[type=text] { text-decoration: line-through; color: var(--muted); }
.tm-step-add input { padding: .45em .8em; margin-top: 4px; }
.tm-zeit { margin: .15em 0; }
.tm-history { margin-top: 1em; }
.tm-history summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.tm-history p { margin: .25em 0; }
.tm-beaten { text-decoration: line-through; opacity: .7; }

/* dialogs and notices */
.tm-dialog {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text);
  padding: 20px; width: min(480px, calc(100vw - 24px)); max-height: calc(100dvh - 40px);
}
.tm-dialog::backdrop { background: rgba(0, 0, 0, .4); }
.tm-dialog-buttons { justify-content: flex-end; margin-top: 1em; }
.tm-manage-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.tm-toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 20px); transform: translateX(-50%); z-index: 20;
  background: var(--text); color: var(--bg); padding: .6em 1em; border-radius: 12px; max-width: calc(100vw - 32px);
}

/* phone: the detail covers the list */
@media (max-width: 820px) {
  .tm-detail { position: fixed; inset: 0; width: auto; z-index: 10; border-left: 0; padding-top: calc(env(safe-area-inset-top, 0px) + 12px); }
  .tm-top h1 { display: none; }
  .tm-bereich { max-width: 60vw; }
  .tm-cards { grid-template-columns: 1fr; }
  .tm-row:has(.tm-review) { flex-wrap: wrap; }
  .tm-review { width: 100%; padding-left: 34px; }
}
