/* ==========================================================================
   tW-Time - Dashboard/Verwaltung Zusatzstile
   Baut komplett auf style.css (Tokens, Farben, Fonts) von JaytW-Studios auf.
   ========================================================================== */

body.app-body { background: var(--bg-soft); min-height: 100vh; }

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar { display: none; }
  .app-sidebar.open { display: flex; }
}

.app-sidebar {
  background: #ffffff;
  border-right: 1px solid var(--border);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.app-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  padding: 6px 8px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.app-brand img { width: 30px; height: 30px; object-fit: contain; }

.app-nav-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .7rem .8rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  font-size: .92rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.app-nav-item:hover { background: var(--blue-soft); color: var(--blue-strong); }
.app-nav-item.active {
  background: var(--glow-soft);
  color: var(--blue-strong);
  border-color: rgba(20, 103, 224, 0.28);
  font-weight: 600;
}
.app-nav-badge {
  margin-left: auto;
  background: var(--glow);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  border-radius: var(--radius-pill);
  padding: 1px 7px;
  min-width: 18px;
  text-align: center;
}
.app-sidebar-spacer { flex: 1; }
.app-sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  font-size: .82rem;
  color: var(--text-faint);
}
.app-sidebar-footer strong { color: var(--text); display: block; margin-bottom: 6px; font-size: .9rem; }

.app-main { padding: 28px 40px 60px; max-width: 1760px; width: 100%; }
@media (max-width: 700px) { .app-main { padding: 20px 16px 48px; } }

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 26px;
  gap: 12px;
}
.app-topbar h1 { font-size: 1.5rem; }
.app-mobile-toggle { display: none; }
@media (max-width: 900px) { .app-mobile-toggle { display: inline-flex; } }

/* ---- panels/cards ---- */
.panel {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
}
.panel + .panel { margin-top: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.panel-head h2 { font-size: 1.05rem; }
.panel-head h3 { font-size: .98rem; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 16px 18px;
}
.stat-card .num { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; color: var(--blue-strong); }
.stat-card .label { font-size: .8rem; color: var(--text-faint); margin-top: 4px; }

/* ---- badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: .7rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
}
.badge-pending { background: rgba(255, 210, 63, 0.14); color: #a3760a; border-color: rgba(200, 156, 0, 0.3); }
.badge-accepted { background: var(--glow-soft); color: var(--blue-strong); border-color: rgba(20, 103, 224, 0.3); }
.badge-rejected { background: rgba(198, 42, 70, 0.1); color: var(--danger); border-color: rgba(198, 42, 70, 0.25); }
.badge-done { background: rgba(23, 138, 82, 0.1); color: var(--success); border-color: rgba(23, 138, 82, 0.25); }
.badge-cancelled { background: rgba(74, 90, 128, 0.12); color: var(--text-faint); border-color: var(--border-strong); }
.badge-dir { background: var(--bg-soft); color: var(--text-faint); border-color: var(--border); }

/* ---- order list ---- */
.order-list { display: flex; flex-direction: column; gap: 10px; }
.order-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
  flex-wrap: wrap;
}
.order-card:hover { border-color: var(--border-strong); background: var(--bg-soft); }
.order-card-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.order-card-title { font-weight: 600; color: var(--text); }
.order-card-sub { font-size: .82rem; color: var(--text-faint); font-family: var(--font-mono); }
.order-card-badges { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.empty-hint { color: var(--text-faint); font-size: .9rem; padding: 18px 4px; text-align: center; }

/* ---- order detail ---- */
.order-detail-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 980px) { .order-detail-grid { grid-template-columns: 1fr; } }

.field-row { display: flex; flex-direction: column; gap: 3px; margin-bottom: 12px; }
.field-row label { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); font-family: var(--font-mono); }
.field-row .value { color: var(--text); font-size: .95rem; }
.field-row .value.muted { color: var(--text-muted); }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-control {
  width: 100%;
  padding: .65rem .8rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  color: var(--text);
  font-size: .92rem;
}
.form-control:focus { outline: none; border-color: var(--blue); background: #fff; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: .78rem; color: var(--text-faint); margin-top: 4px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .form-row-2 { grid-template-columns: 1fr; } }

.checkbox-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.checkbox-row input { width: 16px; height: 16px; }

/* ---- SSH reveal ---- */
.ssh-box { background: var(--code-bg); border: 1px solid var(--code-border); border-radius: var(--radius-sm); padding: 14px 16px; }
.ssh-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; font-family: var(--font-mono); font-size: .86rem; color: var(--code-text); }
.ssh-row + .ssh-row { border-top: 1px solid var(--code-border); }
.ssh-key { color: var(--code-faint); }
.ssh-val { cursor: pointer; user-select: none; color: var(--code-fn); }
.ssh-val.censored { letter-spacing: 2px; }
.ssh-val:hover { color: #fff; }
.ssh-hint { margin-top: 8px; font-size: .72rem; color: var(--code-faint); }

/* ---- todo progress ---- */
#todo-progress:empty { display: none; }
.todo-progress-head {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: .82rem; margin-bottom: 6px;
}
.todo-progress-head span:first-child { font-weight: 700; color: var(--success); font-family: var(--font-display); }
.todo-progress-head span:last-child { color: var(--text-faint); font-family: var(--font-mono); font-size: .76rem; }
.todo-progress-track {
  height: 8px; border-radius: var(--radius-pill); background: var(--bg-soft);
  border: 1px solid var(--border); overflow: hidden; margin-bottom: 14px;
}
.todo-progress-fill {
  height: 100%; border-radius: var(--radius-pill); background: var(--success);
  box-shadow: 0 0 10px 1px rgba(23, 138, 82, 0.4);
  transition: width .3s ease;
}

/* ---- todos ---- */
.todo-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.todo-item { display: flex; align-items: flex-start; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.todo-item:last-child { border-bottom: none; }
.todo-item input[type="checkbox"] { margin-top: 3px; width: 16px; height: 16px; flex-shrink: 0; }
.todo-text { font-size: .9rem; color: var(--text); }
.todo-text.done { color: var(--text-faint); text-decoration: line-through; }
.todo-meta { font-size: .72rem; color: var(--text-faint); margin-top: 2px; }
.todo-add-row { display: flex; gap: 8px; margin-top: 10px; }
.todo-add-row input { flex: 1; }

/* ---- chat ---- */
.chat-panel { display: flex; flex-direction: column; height: 520px; }
.chat-messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 2px 12px; }
.chat-bubble { max-width: 78%; padding: 9px 13px; border-radius: 12px; font-size: .88rem; line-height: 1.5; }
.chat-bubble .who { font-family: var(--font-mono); font-size: .68rem; color: var(--text-faint); margin-bottom: 3px; }
.chat-bubble.mine { align-self: flex-end; background: var(--glow-soft); border: 1px solid rgba(20,103,224,.25); border-bottom-right-radius: 3px; }
.chat-bubble.theirs { align-self: flex-start; background: var(--bg-soft); border: 1px solid var(--border); border-bottom-left-radius: 3px; }
.chat-input-row { display: flex; gap: 8px; margin-top: 10px; }
.chat-input-row input { flex: 1; }

/* ---- timer ---- */
.timer-display { font-family: var(--font-mono); font-size: 2.1rem; font-weight: 600; color: var(--blue-strong); letter-spacing: .02em; }
.timer-cost { font-family: var(--font-mono); font-size: .92rem; color: var(--text-muted); margin-top: 4px; }
.timer-actions { margin-top: 14px; display: flex; gap: 10px; }
.timer-running-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--success); display: inline-block; margin-right: 6px; animation: pulse-dot 1.4s ease-in-out infinite; }
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ---- search dropdown ---- */
.search-wrap { position: relative; }
.search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 14px 30px -14px rgba(15,30,70,.25);
  max-height: 240px;
  overflow-y: auto;
  z-index: 20;
}
.search-result-item { padding: 9px 14px; font-size: .9rem; cursor: pointer; }
.search-result-item:hover { background: var(--blue-soft); }
.search-result-empty { padding: 10px 14px; font-size: .85rem; color: var(--text-faint); }
.selected-company-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--blue-soft); color: var(--blue-strong);
  padding: 6px 12px; border-radius: var(--radius-pill); font-size: .88rem; font-weight: 600;
  margin-top: 8px;
}
.selected-company-chip button { background: none; border: none; color: var(--blue-strong); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0; }

/* ---- toast ---- */
#toast-host { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast {
  background: #0d1c3a; color: #fff; padding: 12px 18px; border-radius: var(--radius-sm);
  font-size: .88rem; box-shadow: 0 14px 30px -12px rgba(0,0,0,.4);
  animation: toast-in .2s ease-out;
  max-width: 320px;
}
.toast.error { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---- table (Verwaltung) ---- */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.data-table th { text-align: left; font-family: var(--font-mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); padding: 8px 10px; border-bottom: 1px solid var(--border-strong); }
table.data-table td { padding: 10px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data-table tr:last-child td { border-bottom: none; }

.link-back { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--text-muted); margin-bottom: 14px; }
.link-back:hover { color: var(--blue-strong); }

.spinner-hint { font-family: var(--font-mono); font-size: .82rem; color: var(--text-faint); padding: 20px 4px; }

/* ---- Auftrag stornieren ---- */
.cancel-order-zone { text-align: center; padding: 26px 22px; }
.btn-cancel-order {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .85rem 1.8rem;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .95rem;
  letter-spacing: .01em;
  color: #fff;
  background: var(--danger);
  border: 1px solid transparent;
  box-shadow: 0 0 0 1px rgba(198, 42, 70, 0.4), 0 0 26px 4px rgba(198, 42, 70, 0.4), 0 10px 26px -10px rgba(198, 42, 70, 0.55);
  transition: box-shadow .2s ease, background-color .2s ease, transform .15s ease;
  cursor: pointer;
}
.btn-cancel-order:hover { background: #a91f38; box-shadow: 0 0 0 1px rgba(198, 42, 70, 0.55), 0 0 36px 6px rgba(198, 42, 70, 0.5), 0 12px 30px -8px rgba(198, 42, 70, 0.6); }
.btn-cancel-order:active { transform: scale(0.98); }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 28, 58, 0.6);
  backdrop-filter: blur(3px);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay .panel { max-width: 440px; width: 100%; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions .btn-ghost { flex: 1; }

.btn-hold-cancel {
  position: relative;
  flex: 1.4;
  overflow: hidden;
  padding: .85rem 1rem;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .88rem;
  color: #fff;
  background: var(--danger);
  border: 1px solid transparent;
  box-shadow: 0 0 0 1px rgba(198, 42, 70, 0.4), 0 0 20px 3px rgba(198, 42, 70, 0.35);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.btn-hold-cancel:hover { box-shadow: 0 0 0 1px rgba(198, 42, 70, 0.55), 0 0 28px 5px rgba(198, 42, 70, 0.45); }
.btn-hold-fill {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 0%;
  background: rgba(255, 255, 255, 0.3);
  pointer-events: none;
}
.btn-hold-cancel span { position: relative; z-index: 1; }

/* ---- Helfer-Firmen ---- */
.glow-mark--red {
  border-color: rgba(198, 42, 70, 0.4);
  background: rgba(198, 42, 70, 0.04);
  box-shadow:
    0 0 0 1px rgba(198, 42, 70, 0.14),
    0 0 34px 3px rgba(198, 42, 70, 0.3),
    inset 0 0 26px rgba(198, 42, 70, 0.06);
}
.helper-banner { padding: 16px 20px; margin-bottom: 18px; }
.helper-banner strong { display: block; color: var(--danger); font-family: var(--font-display); margin-bottom: 4px; }
.helper-banner p { color: var(--text-muted); font-size: .88rem; margin: 0; }

.helper-list { display: flex; flex-direction: column; gap: 8px; }
.helper-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 13px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .88rem;
}
.helper-row button {
  background: none; border: 1px solid var(--border-strong); color: var(--danger);
  border-radius: var(--radius-sm); padding: .3rem .8rem; font-size: .78rem; cursor: pointer;
}
.helper-row button:hover { background: rgba(198, 42, 70, .08); border-color: var(--danger); }

/* ---- Zeitstempel pro Firma (Ein-/Ausstempeln statt einmaligem Start/Stop) ---- */
.time-company-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 13px 15px; margin-bottom: 10px; }
.time-company-card:last-child { margin-bottom: 0; }
.time-company-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.time-company-name { font-weight: 600; font-size: .92rem; display: inline-flex; align-items: center; gap: 6px; }
.time-company-duration {
  font-family: var(--font-mono); font-size: 1.05rem; color: var(--blue-strong);
  cursor: pointer; display: flex; align-items: center; gap: 8px; user-select: none;
}
.time-log-hint { font-family: var(--font-body); font-size: .72rem; color: var(--text-faint); font-weight: 500; }
.time-company-log {
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border);
  font-size: .8rem; color: var(--text-muted); display: flex; flex-direction: column; gap: 4px;
}
.time-log-entry { font-family: var(--font-mono); font-size: .76rem; }

.btn-clock {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1.1rem; border-radius: var(--radius-pill);
  font-family: var(--font-display); font-weight: 600; font-size: .82rem;
  color: #fff; border: 1px solid transparent; cursor: pointer;
  transition: box-shadow .2s ease, background-color .2s ease, transform .15s ease;
}
.btn-clock:active { transform: scale(0.97); }
.btn-clock-in { background: var(--success); box-shadow: 0 0 0 1px rgba(23,138,82,.4), 0 0 20px 3px rgba(23,138,82,.4); }
.btn-clock-in:hover { background: #136f42; box-shadow: 0 0 0 1px rgba(23,138,82,.55), 0 0 26px 5px rgba(23,138,82,.5); }
.btn-clock-out { background: var(--danger); box-shadow: 0 0 0 1px rgba(198,42,70,.4), 0 0 20px 3px rgba(198,42,70,.4); }
.btn-clock-out:hover { background: #a91f38; box-shadow: 0 0 0 1px rgba(198,42,70,.55), 0 0 26px 5px rgba(198,42,70,.5); }

/* ---- To-Do löschen ---- */
.todo-delete-btn {
  background: none; border: none; color: var(--text-faint); cursor: pointer;
  font-size: .95rem; padding: 2px 6px; flex-shrink: 0; align-self: flex-start;
}
.todo-delete-btn:hover { color: var(--danger); }
