/* ==========================================================================
   Verwaltung: Team
   ========================================================================== */

.tm-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tm-stats > div { display: grid; gap: 2px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.tm-stats b { font-size: 1.7rem; line-height: 1.1; }
.tm-stats span { color: var(--muted); font-size: 0.82rem; }
.tm-stats .is-warn b { color: #ffc857; }

.tm-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; padding-bottom: 2px; border-bottom: 1px solid var(--line); }
.tm-tab { position: relative; padding: 10px 18px; border: 0; background: none; color: var(--muted); font: inherit; font-weight: 500; cursor: pointer; transition: color 0.2s; }
.tm-tab:hover { color: var(--text); }
.tm-tab.is-active { color: var(--accent); }
.tm-tab.is-active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -3px; height: 2px; border-radius: 2px; background: var(--accent); }

/* Avatar, Chips */
.tm-avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: rgba(9, 78, 82, 0.5); }
.tm-avatar.is-lg { width: 60px; height: 60px; }
.tm-avatar-fallback { display: grid; place-items: center; color: var(--accent); font-weight: 700; }
.tm-chip { display: inline-block; max-width: 100%; padding: 3px 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 1px solid color-mix(in srgb, var(--c, var(--accent)) 55%, transparent); border-radius: 999px; background: color-mix(in srgb, var(--c, var(--accent)) 14%, transparent); color: var(--c, var(--accent)); font-size: 0.78rem; font-weight: 600; }
.tm-chip.is-pos { border-style: dashed; }
.tm-none { color: #5f8484; font-size: 0.82rem; }
.tm-dots { display: inline-flex; gap: 4px; }
.tm-dots i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, 0.12); }
.tm-dots i.on { background: #ffc857; box-shadow: 0 0 8px rgba(255, 200, 87, 0.5); }

/* Teamliste */
.tm-filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.tm-filters input[type="search"] { flex: 1 1 260px; max-width: 420px; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: rgba(1, 16, 21, 0.75); color: var(--text); font: inherit; font-size: 0.94rem; }
.tm-filters input[type="search"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(24, 223, 207, 0.14); }
.tm-roster { display: grid; gap: 8px; }
.tm-row { display: grid; grid-template-columns: 40px minmax(150px, 1.3fr) minmax(130px, 1fr) minmax(130px, 1.2fr) auto auto; align-items: center; gap: 14px; width: 100%; padding: 10px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color 0.2s, background 0.2s, transform 0.15s; }
.tm-row:hover { border-color: var(--line-strong); background: var(--surface-hover); transform: translateX(2px); }
.tm-row.is-suspended { border-color: rgba(255, 200, 87, 0.3); }
.tm-row.is-suspended .tm-avatar { filter: grayscale(0.7); }
.tm-who { display: grid; min-width: 0; }
.tm-who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-who small { color: var(--muted); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; }
.tm-pos { display: flex; flex-wrap: wrap; gap: 4px; }
.tm-rank, .tm-pos { min-width: 0; }

.tm-former { margin-top: 26px; }
.tm-former-toggle { display: inline-flex; align-items: center; gap: 8px; padding: 8px 0; border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }
.tm-former-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; transition: transform 0.2s; }
.tm-former-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.tm-former-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; margin-top: 8px; border: 1px dashed var(--line); border-radius: 12px; }

/* Detail */
.tm-head { justify-content: flex-start; gap: 16px; }
.tm-head-main { flex: 1; min-width: 0; }
.tm-head-main h3 { overflow-wrap: anywhere; }
.tm-head-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.tm-detail-body { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr); min-height: 0; overflow-y: auto; }
.tm-detail-main, .tm-detail-side { display: grid; align-content: start; gap: 22px; padding: 20px 22px; }
.tm-detail-side { border-left: 1px solid var(--line); background: rgba(1, 16, 21, 0.4); }
.tm-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.tm-actions .btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; margin-right: 4px; }
.tm-section { display: grid; gap: 10px; }
.tm-section-head { display: flex; align-items: center; gap: 10px; }
.tm-section-head h4 { font-size: 0.95rem; font-style: normal; }
.tm-section-head .muted, .muted { color: var(--muted); font-size: 0.85rem; }
.tm-warn { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid rgba(255, 200, 87, 0.28); border-radius: 12px; background: rgba(255, 200, 87, 0.06); }
.tm-warn-n { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: rgba(255, 200, 87, 0.2); color: #ffc857; font-size: 0.8rem; font-weight: 700; }
.tm-warn-main { flex: 1; min-width: 0; }
.tm-warn-main p, .tm-note p { margin: 0 0 3px; overflow-wrap: anywhere; line-height: 1.5; white-space: pre-wrap; }
.tm-warn-main small, .tm-note small { color: var(--muted); font-size: 0.78rem; }
.tm-note-form { display: grid; gap: 8px; justify-items: end; }
.tm-note-form textarea { width: 100%; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: rgba(1, 16, 21, 0.75); color: var(--text); font: inherit; font-size: 0.92rem; resize: vertical; }
.tm-note-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(24, 223, 207, 0.14); }
.tm-note { position: relative; padding: 12px 44px 12px 14px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 12px; background: rgba(9, 78, 82, 0.14); }
.tm-note .icon-btn { position: absolute; top: 6px; right: 6px; }
.tm-role-list { display: flex; flex-wrap: wrap; gap: 6px; }

/* Verlauf */
.tm-timeline { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.tm-log-item { position: relative; display: flex; gap: 12px; padding: 0 0 16px 4px; }
.tm-log-item::before { content: ""; position: absolute; left: 17px; top: 30px; bottom: 0; width: 1px; background: var(--line); }
.tm-log-item:last-child::before { display: none; }
.tm-log-icon { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--line-strong); border-radius: 50%; background: rgba(1, 16, 21, 0.8); font-size: 0.85rem; }
.tm-log-item div { min-width: 0; font-size: 0.9rem; }
.tm-log-item p { margin: 3px 0; color: #cfe6e5; overflow-wrap: anywhere; }
.tm-log-item small { color: var(--muted); font-size: 0.78rem; }
.tm-change { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.tm-timeline.is-wide { max-width: 760px; }
.tm-timeline.is-wide .tm-log-item { padding-bottom: 20px; }

/* Kalender */
.tm-cal-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.tm-cal-nav { display: flex; align-items: center; gap: 10px; }
.tm-cal-nav h3 { min-width: 170px; text-align: center; font-size: 1.15rem; font-style: normal; }
.tm-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 12px; color: var(--muted); font-size: 0.8rem; }
.tm-legend span { display: inline-flex; align-items: center; gap: 6px; }
.tm-legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.tm-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: rgba(1, 16, 21, 0.5); }
.tm-wd { padding: 10px 8px; border-bottom: 1px solid var(--line); background: rgba(9, 78, 82, 0.2); color: var(--muted); font-size: 0.78rem; font-weight: 600; text-align: center; text-transform: uppercase; letter-spacing: 0.06em; }
.tm-cell { display: grid; align-content: start; gap: 3px; min-height: 104px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); cursor: pointer; transition: background 0.15s; }
.tm-cell:nth-child(7n + 7) { border-right: 0; }
.tm-cell:hover { background: rgba(24, 223, 207, 0.05); }
.tm-cell.is-other { opacity: 0.45; }
.tm-cell.is-today { background: rgba(24, 223, 207, 0.08); box-shadow: inset 0 0 0 1px var(--accent); }
.tm-day { justify-self: start; display: grid; place-items: center; min-width: 24px; height: 24px; padding: 0 4px; border-radius: 12px; font-size: 0.8rem; font-weight: 600; }
.tm-cell.is-today .tm-day { background: var(--accent); color: var(--on-accent); }
.tm-ev { display: block; width: 100%; padding: 2px 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 0; border-left: 3px solid var(--c); border-radius: 6px; background: color-mix(in srgb, var(--c) 18%, transparent); color: var(--text); font: inherit; font-size: 0.74rem; text-align: left; cursor: pointer; }
.tm-ev:hover { background: color-mix(in srgb, var(--c) 32%, transparent); }
.tm-ev b { font-weight: 700; }
.tm-more { color: var(--muted); font-size: 0.72rem; padding-left: 4px; }
.tm-upcoming { margin-top: 24px; }
.tm-up { display: flex; align-items: center; gap: 14px; width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color 0.2s; }
.tm-up:hover { border-color: var(--line-strong); }
.tm-up i { flex: none; width: 8px; height: 32px; border-radius: 4px; background: var(--c); }
.tm-up-main { display: grid; flex: 1; min-width: 0; }
.tm-up-main strong, .tm-up-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-up-main small { color: var(--muted); font-size: 0.78rem; }
.tm-up-date { flex: none; color: var(--muted); font-size: 0.84rem; }

/* Notizbrett */
.tm-board-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.tm-board-head p { max-width: 640px; }
.tm-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 14px; }
.tm-card { display: grid; align-content: start; gap: 10px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.tm-card:hover { border-color: var(--accent); }
.tm-card.is-pinned { border-color: rgba(255, 200, 87, 0.4); background: rgba(255, 200, 87, 0.05); }
.tm-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.tm-card h4 { font-size: 1rem; font-style: normal; overflow-wrap: anywhere; }
.tm-card-tools { display: flex; flex: none; }
.tm-card-text { color: #cfe6e5; font-size: 0.92rem; line-height: 1.55; overflow-wrap: anywhere; }
.tm-card-text.is-clamped { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.tm-card-text a { color: #6fd6ff; }
.tm-card-text blockquote { margin: 4px 0; padding-left: 10px; border-left: 3px solid rgba(24, 223, 207, 0.45); }
.tm-card-text code { padding: 1px 5px; border-radius: 5px; background: rgba(0, 0, 0, 0.35); }
.tm-card-text pre { margin: 6px 0; padding: 8px 12px; overflow-x: auto; border-radius: 8px; background: rgba(0, 0, 0, 0.4); }
.tm-card-text .tr-h { font-weight: 700; margin: 4px 0 2px; }
.tm-card-text .tr-mention { padding: 0 4px; border-radius: 4px; background: rgba(91, 140, 255, 0.2); color: #9db7ff; }
.tm-card small { color: var(--muted); font-size: 0.78rem; }

.tm-note-preview { min-height: 90px; max-height: 260px; overflow-y: auto; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: rgba(1, 16, 21, 0.6); }

@media (max-width: 1100px) {
  .tm-row { grid-template-columns: 40px minmax(0, 1fr) auto auto; }
  .tm-rank { grid-column: 2; }
  .tm-pos { grid-column: 2 / -1; }
}
@media (max-width: 860px) {
  .tm-detail-body { grid-template-columns: 1fr; }
  .tm-detail-side { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 720px) {
  .tm-cell { min-height: 70px; padding: 4px; }
  .tm-ev { font-size: 0.66rem; padding: 1px 4px; }
  .tm-ev b { display: none; }
  .tm-row { gap: 10px; padding: 10px 12px; }
  .tm-cal-nav h3 { min-width: 0; font-size: 1rem; }
}

.tm-shield { display: inline-flex; align-items: center; gap: 4px; padding: 3px 11px; border: 1px solid rgba(24, 223, 207, 0.4); border-radius: 999px; background: rgba(24, 223, 207, 0.1); color: var(--accent); font-size: 0.78rem; font-weight: 600; white-space: nowrap; }

/* Dienststatus und Abmeldung in der Teamliste */
.tm-duty { display: inline-block; width: 9px; height: 9px; margin-right: 7px; border-radius: 50%; background: #6ee7a0; box-shadow: 0 0 0 0 rgba(110, 231, 160, 0.5); animation: live-pulse 2.2s infinite; vertical-align: 1px; }
.tm-away { color: #ffc857; font-weight: 600; }
.tm-head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }

/* Abmeldungen */
.tm-abs { position: relative; display: flex; align-items: flex-start; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.tm-abs.is-active { border-color: rgba(255, 200, 87, 0.4); background: rgba(255, 200, 87, 0.06); }
.tm-abs.is-past, .tm-abs.is-withdrawn { opacity: 0.6; }
.tm-abs-ico { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: rgba(255, 200, 87, 0.14); font-size: 1.1rem; }
.tm-abs-main { display: grid; flex: 1; min-width: 0; gap: 2px; }
.tm-abs-dates { color: var(--muted); font-size: 0.84rem; }
.tm-abs-main p { margin: 4px 0 0; color: #cfe6e5; overflow-wrap: anywhere; line-height: 1.5; }
.tm-abs-tools { display: flex; flex: none; }
.tm-abs .status { flex: none; }

/* Stempeluhr */
.tm-clock-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin-bottom: 26px; }
.tm-clock-card { display: grid; align-content: start; gap: 14px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.tm-clock-card h4 { font-size: 0.95rem; font-style: normal; }
.tm-clock-card h4 .muted { margin-left: 6px; }
.tm-clock-now { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(1, 16, 21, 0.5); }
.tm-clock-now div { display: grid; flex: 1; min-width: 0; }
.tm-clock-now small { color: var(--muted); font-size: 0.8rem; }
.tm-clock-now.is-on { border-color: rgba(110, 231, 160, 0.45); background: rgba(110, 231, 160, 0.07); }
.tm-clock-now.is-break { border-color: rgba(255, 200, 87, 0.45); background: rgba(255, 200, 87, 0.07); }
.tm-clock-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; background: #5f8484; }
.tm-clock-now.is-on .tm-clock-dot, .tm-duty-row .tm-clock-dot { background: #6ee7a0; animation: live-pulse 2.2s infinite; }
.tm-clock-now.is-break .tm-clock-dot, .tm-clock-dot.is-break { background: #ffc857; animation: none; }
.tm-clock-time { font: 700 1.5rem/1 ui-monospace, Consolas, monospace; letter-spacing: 0.02em; }
.tm-clock-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.tm-clock-actions .btn-success { padding: 12px 26px; font-size: 1rem; }
.tm-duty-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.tm-duty-row:last-child { border-bottom: 0; }
.tm-duty-row strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-duty-row small { color: var(--muted); }
.tm-duty-row b { font: 600 0.92rem ui-monospace, Consolas, monospace; }
.tm-week-row { display: grid; grid-template-columns: minmax(90px, 200px) 1fr auto; align-items: center; gap: 14px; padding: 6px 0; }
.tm-bar { height: 10px; border-radius: 6px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.tm-bar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--accent-deep), var(--accent)); }
.tm-week-row b { font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.tm-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
.tm-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.tm-table th { padding: 10px 14px; border-bottom: 1px solid var(--line); background: rgba(9, 78, 82, 0.2); color: var(--muted); font-size: 0.74rem; font-weight: 600; letter-spacing: 0.06em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.tm-table td { padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tm-table tr:last-child td { border-bottom: 0; }
.tm-live { color: #6ee7a0; font-weight: 700; }
.tm-flag { padding: 1px 8px; border-radius: 999px; background: rgba(255, 200, 87, 0.14); color: #ffc857; font-size: 0.7rem; font-weight: 600; white-space: nowrap; }
.tm-flag.is-edit { background: rgba(76, 194, 255, 0.14); color: #7fd3ff; }

@media (max-width: 640px) {
  .tm-abs { flex-wrap: wrap; }
  .tm-week-row { grid-template-columns: 1fr auto; }
  .tm-week-row .tm-bar { grid-column: 1 / -1; order: 3; }
}

/* Inaktiv: seit Tagen nicht eingestempelt (und nicht abgemeldet) */
.tm-row.is-inactive { border-color: rgba(255, 107, 107, 0.85); box-shadow: 0 0 0 1px rgba(255, 107, 107, 0.55), 0 0 18px -6px rgba(255, 107, 107, 0.6); background: rgba(255, 107, 107, 0.06); }
.tm-row.is-inactive:hover { border-color: #ff6b6b; background: rgba(255, 107, 107, 0.1); }
.tm-inactive-note { display: block; margin-top: 1px; color: #ff8f8f; font-size: 0.72rem; font-style: normal; font-weight: 600; letter-spacing: 0.01em; }
.tm-stats .is-bad b { color: #ff6b6b; }
.tm-inactive-chip, .tm-away-chip { display: inline-flex; align-items: center; padding: 3px 11px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.tm-inactive-chip { border: 1px solid rgba(255, 107, 107, 0.6); background: rgba(255, 107, 107, 0.12); color: #ff8f8f; }
.tm-away-chip { border: 1px solid rgba(255, 200, 87, 0.5); background: rgba(255, 200, 87, 0.1); color: #ffc857; }

/* Abmeldungen: Entscheidung */
.tm-abs.is-pending { border-color: rgba(255, 200, 87, 0.45); background: rgba(255, 200, 87, 0.05); }
.tm-abs.is-rejected { border-color: rgba(255, 107, 107, 0.35); opacity: 0.8; }
.tm-abs.is-expired { opacity: 0.55; }
.tm-abs-decision { color: var(--muted); font-size: 0.8rem; }
.tm-abs-decide { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tm-section.is-attention > .tm-section-head h4 { color: #ffc857; }

/* Meine Uebersicht */
.tm-me-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.tm-inactive-banner { margin: 0 0 16px; padding: 12px 16px; border: 1px solid rgba(255, 107, 107, 0.6); border-radius: 12px; background: rgba(255, 107, 107, 0.08); color: #ffb3b3; line-height: 1.5; }
