/* Dashboard-Layout: Topbar + zweistufige Mandanten/Kontext-File-Liste + Upload-Modal */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.brand { font-family: var(--display); font-weight: 600; font-size: 18px; margin-right: 10px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.credits-badge {
  font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  padding: 6px 12px;
}
.info-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--line); color: var(--ink-soft);
  text-decoration: none;
}
.info-btn:hover { color: var(--ink); border-color: var(--ink-soft); }

.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 28px 0 14px;
}
.section-head h1 { font-family: var(--display); font-size: 20px; margin: 0; }

.new-client-form {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; margin-bottom: 16px;
}
.new-client-form.hidden { display: none; }
.new-client-form input {
  flex: 1; min-width: 180px; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 7px; font: inherit;
}
.new-client-form input:focus { outline: 2px solid var(--safe); outline-offset: 1px; }
.new-client-form #newClientName2 { flex-basis: 100%; }
.add-name2-link {
  flex-basis: 100%; font-size: 12.5px; color: var(--ink-soft); text-decoration: none;
  margin-top: -6px;
}
.add-name2-link:hover { text-decoration: underline; }
.add-name2-link.hidden { display: none; }

.client-list { display: flex; flex-direction: column; gap: 12px; }

/* --- Ebene 1: Mandant (nutzt .file/.file-head/.file-body aus styles.css) ------ */
.client-head { flex-wrap: wrap; gap: 10px; }
.client-head .file-name { font-family: var(--display); font-size: 15px; }
.client-note { font-style: italic; }
.btn.ghost.danger { color: var(--danger); border-color: #f0c9c7; }

.client-body { padding: 14px 16px; background: var(--surface); }
.empty-sub { color: var(--ink-soft); font-size: 13px; margin: 4px 0 8px; }

/* --- Ebene 2: Kontext-File --------------------------------------------------- */
.cf-list { display: flex; flex-direction: column; gap: 8px; }
.cf-row {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
}
.cf-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; flex-wrap: wrap;
}
.cf-name { font-weight: 600; flex: 1; min-width: 140px; word-break: break-word; }
.cf-body { display: none; border-top: 1px solid var(--line); padding: 14px; }
.cf-row.open .cf-body { display: block; }

.mapping-note { font-size: 12px; color: var(--ink-soft); margin: 10px 0 0; }
.mapping-note b { color: var(--warn); }

/* --- Verarbeitungs-Fortschritt (statt "Laedt ...") ---------------------- */
.progress-panel { display: flex; flex-direction: column; gap: 12px; padding: 6px 2px; }
.progress-step {
  display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-soft);
}
.progress-step.active { color: var(--ink); font-weight: 600; }
.progress-step.done { color: var(--safe); }
.progress-dot {
  flex: 0 0 auto; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--line); position: relative;
}
.progress-step.done .progress-dot {
  border-color: var(--safe); background: var(--safe);
}
.progress-step.done .progress-dot::after {
  content: ""; position: absolute; left: 4px; top: 1px; width: 4px; height: 8px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.progress-step.active .progress-dot {
  border-color: var(--cloud); border-top-color: transparent;
  animation: progress-spin 0.7s linear infinite;
}
@keyframes progress-spin { to { transform: rotate(360deg); } }
.progress-filename {
  margin: 2px 0 0 26px; font-family: var(--mono); font-size: 11.5px; color: var(--ink-soft);
}

/* --- Upload-Modal ------------------------------------------------------------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 36, 41, 0.45);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--card); border-radius: var(--radius); border: 1px solid var(--line);
  padding: 24px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h2 { font-family: var(--display); font-size: 18px; margin: 0; }
.modal-close {
  background: none; border: none; font-size: 22px; line-height: 1; cursor: pointer;
  color: var(--ink-soft); padding: 0 4px;
}
.modal .field { margin-bottom: 14px; }
.modal .field label { display: block; font-size: 12px; font-family: var(--mono); color: var(--ink-soft); margin-bottom: 5px; }
.modal .field input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px; font: inherit;
}
.modal .field input:focus { outline: 2px solid var(--safe); outline-offset: 1px; }
.modal .drop { margin-top: 4px; padding: 26px 16px; }
.modal .actions { justify-content: flex-end; }
.modal-hint { font-size: 12px; color: var(--ink-soft); margin: 12px 0 0; }
#uploadCostHint { font-weight: 600; color: var(--ink); }

.upload-progress { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.upload-progress.hidden { display: none; }
.upload-progress-track {
  flex: 1; height: 6px; border-radius: 4px; background: var(--surface); overflow: hidden;
}
.upload-progress-fill {
  height: 100%; width: 0%; background: var(--safe); transition: width 0.15s ease-out;
}
.upload-progress span {
  font-family: var(--mono); font-size: 12px; color: var(--ink-soft); min-width: 38px; text-align: right;
}

/* --- Verlauf (Kauf/Verbrauch) --------------------------------------------- */
.tx-list { max-height: 360px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.tx-row {
  display: grid; grid-template-columns: auto 1fr auto auto; gap: 12px; align-items: center;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px;
}
.tx-kind { font-weight: 600; }
.tx-note { color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-date { font-family: var(--mono); font-size: 11.5px; color: var(--ink-soft); white-space: nowrap; }
.tx-amount { font-family: var(--mono); font-weight: 600; white-space: nowrap; }
.tx-amount.pos { color: var(--safe); }
.tx-amount.neg { color: var(--ink-soft); }

@media (max-width: 480px) {
  .tx-row { grid-template-columns: 1fr auto; }
  .tx-note, .tx-date { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
  .cf-head { flex-direction: column; align-items: flex-start; }
}

/* --- Footer -------------------------------------------------------------- */
.site-footer {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: center; gap: 16px;
  padding: 12px; background: var(--surface);
}
.site-footer a {
  font-size: 12px; color: #4a5f64; text-decoration: none;
}

/* --- Admin ----------------------------------------------------------------- */
.admin-scope-hint { margin-bottom: 20px; }
.admin-summary { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.admin-stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 18px; display: flex; flex-direction: column; gap: 2px; min-width: 120px;
}
.admin-stat .n { font-family: var(--display); font-size: 22px; font-weight: 600; }
.admin-stat .l { font-size: 12px; color: var(--ink-soft); }

.admin-table-wrap {
  overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
}
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; white-space: nowrap; }
.admin-table th, .admin-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.admin-table th { font-family: var(--mono); font-size: 11px; text-transform: uppercase; color: var(--ink-soft); }
.admin-table tbody tr:last-child td { border-bottom: none; }
/* E-Mail-Spalte bleibt beim horizontalen Scrollen sichtbar - das ist die
   Spalte, an der man einen Account ueberhaupt erkennt. */
.admin-table th:first-child, .admin-table td:first-child {
  position: sticky; left: 0; background: var(--card); border-right: 1px solid var(--line);
  font-weight: 600;
}
