/* ===========================================================
   Operation Tracker — v3 additive layer
   Dashboard · KPI-Trends · Bulk-Auswahl · Schnell-Erfassung
   Mehrere Zuständige · Anhänge · Kommentare · Wiederholung
   Export · Schichtübergabe · Archiv · Tastenkürzel · Mobil
   =========================================================== */

/* ---------- KPI as button + trends ---------- */
.rt-kpi { font: inherit; text-align: left; cursor: pointer; color: var(--fg); }
.rt-kpi { appearance: none; -webkit-appearance: none; }
.rt-kpi { transition: border-color .2s, transform .2s, background .2s; }
.rt-kpi:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.rt-kpi .trend {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .04em; margin-top: 7px;
  height: 13px; color: var(--faint);
}
.rt-kpi .trend.good { color: #41d77f; }
.rt-kpi .trend.bad { color: #ff6b6b; }
.rt-kpi .trend.flat { color: var(--faint); }

/* ---------- search clear + focus + more-filter button ---------- */
.rt-search-clear {
  border: none; background: none; color: var(--faint); cursor: pointer; font-size: 12px;
  width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; flex: none;
}
.rt-search-clear:hover { color: var(--fg); background: rgba(255,255,255,.08); }
#rtFocusOver.active { color: #1c0f06; background: #ff8a5c; border-color: #ff8a5c; }
#rtMoreBtn.has-filters { color: var(--accent); border-color: color-mix(in oklab, var(--accent) 50%, var(--line)); }

/* more-filters menu groups */
.rt-more-menu { min-width: 220px; }
.rt-more-grp {
  font-family: var(--font-mono); font-size: 9px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--faint); padding: 9px 12px 4px;
}
.rt-more-sep { height: 1px; background: var(--line); margin: 6px 8px; }
.rt-more-menu [data-act="clearfilters"] { color: #ff8a5c; }

/* ---------- card: order id, avatar stack, flags, select ---------- */
.rt-orderid {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .06em;
  color: var(--accent-2); margin-bottom: 3px;
}
.rt-avstack { display: inline-flex; align-items: center; }
.rt-avstack > * { margin-left: -7px; box-shadow: 0 0 0 2px var(--bg-soft), inset 0 0 0 1px rgba(255,255,255,.18); }
.rt-avstack > *:first-child { margin-left: 0; }
.avatar.more { background: var(--line-strong); color: var(--fg); font-size: 9.5px; }
.cflags { display: inline-flex; gap: 5px; align-items: center; }
.rt-flag {
  font-family: var(--font-mono); font-size: 9.5px; color: var(--faint);
  display: inline-flex; align-items: center; gap: 2px;
}
.rt-flag.rec { color: var(--accent-2); }
.rt-card .rt-select {
  position: absolute; top: 10px; left: 10px; width: 22px; height: 22px; border-radius: 7px;
  border: 1.5px solid var(--line-strong); background: color-mix(in oklab, var(--bg) 70%, transparent);
  display: grid; place-items: center; cursor: pointer; opacity: 0; transform: scale(.85);
  transition: opacity .15s, transform .15s, background .15s; z-index: 4;
}
.rt-card .rt-select i { font-size: 12px; color: transparent; line-height: 1; }
.rt-card:hover .rt-select { opacity: 1; transform: scale(1); }
.rt-card.selected .rt-select { opacity: 1; transform: scale(1); background: var(--accent); border-color: var(--accent); }
.rt-card.selected .rt-select i { color: #1c0f06; }
.rt-card.selected { box-shadow: 0 0 0 2px var(--accent), var(--shadow-soft); }

/* ---------- quick add per column ---------- */
.rt-quickadd { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.rt-quickadd input {
  flex: 1; min-width: 0; background: rgba(255,255,255,.02); border: 1px dashed var(--line-strong);
  border-radius: 12px; padding: 10px 12px; color: var(--fg); font-family: var(--font-body);
  font-size: 13px; outline: none; transition: border-color .2s, background .2s;
}
.rt-quickadd input::placeholder { color: var(--faint); }
.rt-quickadd input:focus { border-style: solid; border-color: var(--accent); background: rgba(255,255,255,.04); }
.rt-quickadd .qa-full {
  flex: none; width: 36px; height: 36px; border-radius: 11px; border: 1px solid var(--line);
  background: rgba(255,255,255,.02); color: var(--muted); cursor: pointer; font-size: 14px;
}
.rt-quickadd .qa-full:hover { color: var(--fg); border-color: var(--line-strong); }

/* ---------- modal: recur, opt label, attachments, comments ---------- */
.rt-opt { font-family: var(--font-mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); font-weight: 400; }
.rt-seg-recur button { flex: 1; }
.rt-recur-hint { font-size: 11.5px; color: var(--faint); margin-top: 8px; line-height: 1.4; }

.rt-attach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-top: 10px; }
.rt-attach-grid:empty { display: none; }
.rt-att { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.rt-att.img { aspect-ratio: 1; }
.rt-att.img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rt-att.doc a { display: flex; flex-direction: column; gap: 3px; padding: 12px 10px; text-decoration: none; background: rgba(255,255,255,.03); height: 100%; }
.rt-att.doc .ico { font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: .08em; color: #ff6b6b; }
.rt-att.doc .nm { font-size: 11.5px; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-att.doc .sz { font-family: var(--font-mono); font-size: 9.5px; color: var(--faint); }
.rt-att .rm {
  position: absolute; top: 5px; right: 5px; width: 20px; height: 20px; border-radius: 50%;
  border: none; background: rgba(10,10,12,.72); color: #fff; cursor: pointer; font-size: 11px;
  display: grid; place-items: center; backdrop-filter: blur(4px);
}
.rt-att .rm:hover { background: #ff6b6b; }
.rt-drop .dh .sub { display: block; font-family: var(--font-mono); font-size: 10px; letter-spacing: .06em; color: var(--faint); margin-top: 4px; }

.rt-comments { display: flex; flex-direction: column; gap: 12px; max-height: 240px; overflow-y: auto; padding: 4px 2px; }
.rt-comment { display: flex; gap: 10px; }
.rt-comment .cc { flex: 1; min-width: 0; }
.rt-comment .ch { display: flex; align-items: baseline; gap: 8px; }
.rt-comment .ch b { font-size: 13px; font-weight: 600; }
.rt-comment .ch span { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .06em; color: var(--faint); }
.rt-comment .cb { font-size: 13.5px; color: var(--muted); margin-top: 2px; line-height: 1.5; word-break: break-word; }
.rt-comment .cb .ment { color: var(--accent-2); font-weight: 600; }
.rt-comment-empty { font-size: 13px; color: var(--faint); padding: 8px 2px; }
.rt-comment-add { display: flex; gap: 8px; margin-top: 10px; }
.rt-comment-add input { flex: 1; }

/* ---------- bulk action bar ---------- */
.rt-bulkbar {
  position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 140%);
  display: flex; align-items: center; gap: 12px; z-index: 70;
  padding: 11px 14px; border-radius: 16px; border: 1px solid var(--line-strong);
  background: color-mix(in oklab, var(--bg-soft) 88%, transparent);
  backdrop-filter: blur(20px) saturate(140%); -webkit-backdrop-filter: blur(20px) saturate(140%);
  box-shadow: var(--shadow-soft); opacity: 0; pointer-events: none; transition: transform .3s var(--ease-out), opacity .3s;
}
.rt-bulkbar.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.rt-bulkbar .cnt { font-size: 13px; color: var(--fg); }
.rt-bulkbar .cnt b { font-family: var(--font-display); font-size: 16px; }
.rt-bulkbar .vsep { width: 1px; height: 22px; background: var(--line); }
.rt-bulk-btn {
  font-family: var(--font-body); font-size: 13px; font-weight: 600; color: var(--fg);
  border: 1px solid var(--line-strong); background: rgba(255,255,255,.04); border-radius: 999px;
  padding: 8px 14px; cursor: pointer; transition: all .2s;
}
.rt-bulk-btn:hover { background: rgba(255,255,255,.09); }
.rt-bulk-btn.danger:hover { background: #ff6b6b; color: #1c0f06; border-color: #ff6b6b; }
.rt-bulk-btn.ghost { color: var(--muted); border-color: transparent; background: none; }
.rt-bulk-move { position: relative; }
.rt-bulk-move > button {
  font-family: var(--font-body); font-size: 13px; font-weight: 600; color: var(--fg);
  border: 1px solid var(--line-strong); background: rgba(255,255,255,.04); border-radius: 999px;
  padding: 8px 14px; cursor: pointer;
}
.rt-bulk-move > button:hover { background: rgba(255,255,255,.09); }
.rt-bulk-menu {
  position: absolute; bottom: calc(100% + 8px); left: 0; min-width: 180px;
  background: var(--bg-soft); border: 1px solid var(--line-strong); border-radius: 12px;
  padding: 6px; box-shadow: var(--shadow-soft); display: none; max-height: 260px; overflow-y: auto;
}
.rt-bulk-menu.show { display: block; }
.rt-bulk-menu button {
  display: block; width: 100%; text-align: left; font-family: var(--font-body); font-size: 13px;
  color: var(--fg); border: none; background: none; padding: 9px 11px; border-radius: 8px; cursor: pointer;
}
.rt-bulk-menu button:hover { background: rgba(255,255,255,.06); }

/* ---------- DASHBOARD ---------- */
.rt-dashboard { max-width: 1640px; margin: 0 auto; padding: 18px var(--pad) 80px; }
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 22px; }
.dash-head h2 { font-family: var(--font-display); font-weight: 700; font-size: clamp(26px, 3vw, 38px); letter-spacing: -.03em; margin-top: 6px; }
.dash-kpis { display: flex; gap: 10px; flex-wrap: wrap; }
.dash-kpis .dk {
  min-width: 92px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.01));
}
.dash-kpis .dk .n { font-family: var(--font-display); font-weight: 700; font-size: 26px; line-height: 1; letter-spacing: -.03em; }
.dash-kpis .dk .l { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin-top: 6px; }
.dash-kpis .dk.warn .n { color: #ff8a5c; }
.dash-kpis .dk.danger .n { color: #ff6b6b; }
.dash-kpis .dk.good .n { color: #41d77f; }

.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.dash-card {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px;
  background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.012));
}
.dash-card.crit { grid-column: 1 / -1; }
.dc-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.dc-h b { font-family: var(--font-display); font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.dc-h span { font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }

.dbars { display: flex; flex-direction: column; gap: 13px; }
.dbar .dbl { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.dbar .dbl span { color: var(--muted); }
.dbar .dbl b { font-family: var(--font-display); font-weight: 700; }
.dbt { display: block; height: 8px; border-radius: 999px; background: rgba(255,255,255,.06); overflow: hidden; }
.dbt i { display: block; height: 100%; border-radius: 999px; background: var(--accent); transition: width .5s var(--ease-out); }

.dloads { display: flex; flex-direction: column; gap: 14px; }
.dload { display: flex; align-items: center; gap: 11px; }
.dload .dlw { flex: 1; min-width: 0; }
.dload .dll { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; gap: 8px; }
.dload .dll span { color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dload .dll b { font-family: var(--font-mono); font-size: 11px; color: var(--muted); flex: none; }
.dload .dll .ov { color: #ff6b6b; }
.dload.hot .dbt i { background: #ff8a5c; }

.dspark { width: 100%; height: 70px; display: block; }
.dspark-x { display: flex; justify-content: space-between; margin-top: 8px; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .06em; color: var(--faint); }

.dcrit { display: flex; flex-direction: column; }
.dcrit-row { display: flex; align-items: center; gap: 11px; padding: 11px 4px; border-top: 1px solid var(--line); cursor: pointer; transition: background .15s; }
.dcrit-row:first-child { border-top: none; }
.dcrit-row:hover { background: rgba(255,255,255,.03); }
.dcrit-row .ct { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dcrit-row .ct b { font-family: var(--font-mono); font-size: 11px; color: var(--accent-2); }
.dcrit-row .cd { font-family: var(--font-mono); font-size: 11px; color: var(--faint); flex: none; }
.hd { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--faint); }
.hd.overdue { background: #ff6b6b; }
.hd.today { background: #ff8a5c; }
.hd.future { background: #41d77f; }

/* ---------- shift handover ---------- */
.rt-handover { display: flex; flex-direction: column; gap: 20px; }
.ho-grp .ho-h {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px; display: flex; align-items: center; gap: 8px;
}
.ho-grp .ho-h span {
  font-size: 10px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: rgba(255,255,255,.08); display: inline-grid; place-items: center; color: var(--fg);
}
.ho-grp.over .ho-h { color: #ff6b6b; }
.ho-grp.today .ho-h { color: #ff8a5c; }
.ho-grp.done .ho-h { color: #41d77f; }
.ho-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; cursor: pointer; transition: background .15s; }
.ho-item:hover { background: rgba(255,255,255,.04); }
.ho-item .ht { flex: 1; min-width: 0; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ho-item .ht b { font-family: var(--font-mono); font-size: 11px; color: var(--accent-2); }
.ho-item .hm { font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); flex: none; }

/* ---------- archive items ---------- */
.rt-arch-item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--line); }
.rt-arch-item:first-child { border-top: none; }
.rt-arch-item .ai-cat { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.rt-arch-item .ai-main { flex: 1; min-width: 0; }
.rt-arch-item .ai-main b { font-size: 14px; font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-arch-item .ai-main span { font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); }
.rt-arch-item .ai-restore {
  flex: none; width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line);
  background: rgba(255,255,255,.02); color: var(--muted); cursor: pointer; font-size: 15px;
}
.rt-arch-item .ai-restore:hover { color: var(--fg); border-color: var(--line-strong); }

/* ---------- keyboard shortcuts help ---------- */
.rt-kbd-help { position: fixed; inset: 0; z-index: 90; display: none; place-items: center; background: rgba(6,6,8,.55); backdrop-filter: blur(6px); }
.rt-kbd-help.show { display: grid; }
.rt-kbd-card { width: min(420px, 92vw); background: var(--bg-soft); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow-soft); }
.rt-kbd-card .hh { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.rt-kbd-card .hh b { font-family: var(--font-display); font-size: 18px; }
.rt-kbd-card .hh button { border: none; background: none; color: var(--faint); font-size: 17px; cursor: pointer; }
.rt-kbd-card .hh button:hover { color: var(--fg); }
.rt-kbd-card .rows { display: flex; flex-direction: column; gap: 11px; }
.rt-kbd-card .row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); }
.rt-kbd-card .row span { margin-left: auto; }
.rt-kbd-card kbd {
  font-family: var(--font-mono); font-size: 11px; min-width: 22px; height: 22px; padding: 0 7px;
  display: inline-grid; place-items: center; border-radius: 6px; border: 1px solid var(--line-strong);
  background: rgba(255,255,255,.05); color: var(--fg);
}

/* ---------- LIGHT THEME overrides ---------- */
html.theme-light .rt-quickadd input,
html.theme-light .rt-att.doc a,
html.theme-light .dash-kpis .dk,
html.theme-light .dash-card { background: rgba(10,10,14,.025); }
html.theme-light .dbt { background: rgba(10,10,14,.07); }
html.theme-light .rt-bulkbar,
html.theme-light .rt-bulk-menu,
html.theme-light .rt-kbd-card { background: color-mix(in oklab, #fff 92%, transparent); }
html.theme-light .rt-bulk-btn,
html.theme-light .rt-bulk-move > button { background: rgba(10,10,14,.03); }
html.theme-light .avatar.more { background: rgba(10,10,14,.12); }

/* ---------- timeline order id ---------- */
.rt-tl-oid { font-family: var(--font-mono); font-size: 11px; color: var(--accent-2); }

/* ---------- responsive · tablet & phone ---------- */
@media (max-width: 760px) {
  .rt-views button { padding: 8px 12px; font-size: 12.5px; }
  .rt-board { flex-direction: column; overflow-x: visible; }
  .rt-col { width: 100% !important; min-width: 0 !important; }
  .rt-addcol { width: 100%; }
  .rt-quickadd input { padding: 13px 14px; }      /* larger tap target */
  .rt-card { padding: 16px; }
  .rt-card .rt-select { opacity: 1; transform: scale(1); top: 12px; left: 12px; width: 26px; height: 26px; }
  .dash-card.crit { grid-column: auto; }
  .rt-bulkbar { left: 12px; right: 12px; transform: translateY(140%); width: auto; flex-wrap: wrap; justify-content: center; bottom: 78px; }
  .rt-bulkbar.show { transform: translateY(0); }
  .rt-toolbar .title { width: 100%; }
}
@media (max-width: 900px) {
  .rt-kpis { grid-template-columns: repeat(5, 1fr); gap: 8px; }
  .rt-kpi { padding: 12px 12px; }
  .rt-kpi .n { font-size: 24px; }
}
@media (max-width: 560px) {
  .rt-kpis { grid-template-columns: repeat(2, 1fr); }
  .rt-kpi[data-kpi="done"] { grid-column: span 2; }
}
