﻿/* ============================================================
   dashboard.css – ERP-Dashboard (Final)
   Kompakt, informationsdicht, professionell
   ============================================================ */

/* ── Reset / Scope ──────────────────────────────────────────── */
.db-header, .db-kpi-row, .db-mid-grid, .db-bottom-grid,
.db-card, .db-hints-list, .db-hint,
.db-table, .db-finance-dl, .db-activity-list {
  box-sizing: border-box;
}

/* ── Layout-Wrapper (Seite selbst) ──────────────────────────── */
#main-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 20px 24px;
  min-height: 100%;
  background: var(--bg-page, #f0f2f5);
}

/* ── HEADER ─────────────────────────────────────────────────── */
.db-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-card, #fff);
  border-radius: 8px;
  padding: 12px 16px;
  border: 1px solid var(--border, #e2e8f0);
}
.db-header-left { min-width: 0; }
.db-greeting {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary, #1a202c);
  line-height: 1.3;
}
.db-date {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--text-muted, #718096);
}

/* ── Quick-Actions ──────────────────────────────────────────── */
.db-quickactions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}
.db-qa-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 5px;
  background: var(--bg-card, #fff);
  color: var(--text-primary, #1a202c);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.db-qa-btn:hover { background: var(--bg-hover, #f7fafc); border-color: var(--accent, #3182ce); color: var(--accent, #3182ce); }
.db-qa-btn svg { width: 13px; height: 13px; flex-shrink: 0; }

/* ── KPI-REIHE ──────────────────────────────────────────────── */
.db-kpi-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.db-kpi {
  flex: 1 1 130px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 10px 14px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 7px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s;
  border-left: 3px solid transparent;
}
.db-kpi:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.db-kpi-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary, #1a202c);
  line-height: 1.2;
}
.db-kpi-label {
  font-size: 0.72rem;
  color: var(--text-muted, #718096);
  margin-top: 2px;
  line-height: 1.2;
}
.db-kpi-sub {
  font-size: 0.68rem;
  margin-top: 3px;
  color: var(--text-muted, #718096);
  font-style: italic;
}
.db-kpi--danger { border-left-color: #e53e3e; }
.db-kpi--danger .db-kpi-value { color: #e53e3e; }
.db-kpi--danger .db-kpi-sub { color: #c53030; }
.db-kpi--warn   { border-left-color: #dd6b20; }
.db-kpi--warn .db-kpi-value { color: #dd6b20; }
.db-kpi--ok     { border-left-color: #38a169; }
.db-kpi--info   { border-left-color: #3182ce; }

/* ── GRID-LAYOUTS ───────────────────────────────────────────── */
.db-mid-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.db-bottom-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 12px;
}

/* ── CARD ────────────────────────────────────────────────────── */
.db-card {
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  padding: 14px 16px;
  min-width: 0;
  overflow: hidden;
}
.db-card--full {
  grid-column: 1 / -1;
}

/* ── Section Head ────────────────────────────────────────────── */
.db-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border, #e2e8f0);
}
.db-section-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary, #1a202c);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.db-section-link {
  font-size: 0.72rem;
  color: var(--accent, #3182ce);
  text-decoration: none;
  white-space: nowrap;
}
.db-section-link:hover { text-decoration: underline; }

/* ── Subsection Title ───────────────────────────────────────── */
.db-subsec-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted, #718096);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 6px;
}
.db-subsec-title--mt { margin-top: 14px; }

/* ── TABELLEN ────────────────────────────────────────────────── */
.db-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  table-layout: fixed;
}
.db-table thead th {
  text-align: left;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted, #718096);
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: 4px 6px;
  border-bottom: 1px solid var(--border, #e2e8f0);
}
.db-table tbody tr { border-bottom: 1px solid var(--border-light, #f0f2f5); }
.db-table tbody tr:last-child { border-bottom: none; }
.db-table tbody tr:hover { background: var(--bg-hover, #f7fafc); }
.db-table tbody td { padding: 5px 6px; vertical-align: middle; }
.db-table--compact tbody td { padding: 4px 6px; }
.db-table-main { min-width: 0; }
.db-truncate { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.db-truncate-cell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 1px; width: 100%; }
.db-text-bold { font-weight: 600; }
.db-text-sm { font-size: 0.72rem; color: var(--text-secondary, #4a5568); }
.db-text-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.db-row--danger { background: #fff5f5 !important; }
.db-row--warn   { background: #fffaf0 !important; }

/* ── BADGES ──────────────────────────────────────────────────── */
.db-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.5;
}
.db-badge--neutral { background: #edf2f7; color: #4a5568; }
.db-badge--info    { background: #ebf8ff; color: #2b6cb0; }
.db-badge--ok      { background: #f0fff4; color: #276749; }
.db-badge--warn    { background: #fffaf0; color: #c05621; }
.db-badge--danger  { background: #fff5f5; color: #c53030; }
.db-badge--sm      { font-size: 0.62rem; padding: 1px 4px; }

/* ── OPEN BUTTON ──────────────────────────────────────────────── */
.db-row-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted, #718096);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.db-row-btn:hover { background: var(--accent, #3182ce); color: #fff; border-color: var(--accent, #3182ce); }
.db-row-btn svg { width: 11px; height: 11px; }

/* ── MEHR-LINK ───────────────────────────────────────────────── */
.db-more-link {
  display: block;
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--accent, #3182ce);
  text-decoration: none;
  text-align: right;
}
.db-more-link:hover { text-decoration: underline; }

/* ── EMPTY STATE ─────────────────────────────────────────────── */
.db-empty {
  font-size: 0.78rem;
  color: var(--text-muted, #718096);
  font-style: italic;
  margin: 8px 0;
  text-align: center;
  padding: 12px 0;
}

/* ── TECHNIKER BAR ───────────────────────────────────────────── */
.db-tech-bar {
  display: flex;
  gap: 0;
  margin-bottom: 12px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 6px;
  overflow: hidden;
}
.db-tech-bar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px 6px;
  border-right: 1px solid var(--border, #e2e8f0);
}
.db-tech-bar-item:last-child { border-right: none; }
.db-tech-bar-item--warn { background: #fffaf0; }
.db-tech-bar-n {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary, #1a202c);
  line-height: 1;
}
.db-tech-bar-l {
  font-size: 0.62rem;
  color: var(--text-muted, #718096);
  margin-top: 2px;
  text-align: center;
}
.db-tech-bar-item--warn .db-tech-bar-n { color: #c05621; }

/* ── ALERT ───────────────────────────────────────────────────── */
.db-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 7px 10px;
  border-radius: 5px;
  font-size: 0.75rem;
}
.db-alert svg { width: 14px; height: 14px; flex-shrink: 0; }
.db-alert--warn { background: #fffaf0; border: 1px solid #ed8936; color: #7b341e; }
.db-alert--warn svg { color: #dd6b20; }
.db-alert--danger { background: #fff5f5; border: 1px solid #fc8181; color: #742a2a; }
.db-alert-link {
  margin-left: auto;
  font-weight: 600;
  color: var(--accent, #3182ce);
  text-decoration: none;
  white-space: nowrap;
  font-size: 0.72rem;
}
.db-alert-link:hover { text-decoration: underline; }

/* ── HINWEISE ────────────────────────────────────────────────── */
.db-hints-list { display: flex; flex-direction: column; gap: 6px; }
.db-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 5px;
  font-size: 0.78rem;
  border: 1px solid transparent;
}
.db-hint svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 1px; }
.db-hint--danger { background: #fff5f5; border-color: #fc8181; color: #742a2a; }
.db-hint--danger svg { color: #e53e3e; }
.db-hint--warn   { background: #fffaf0; border-color: #ed8936; color: #7b341e; }
.db-hint--warn svg { color: #dd6b20; }
.db-hint--info   { background: #ebf8ff; border-color: #90cdf4; color: #2c5282; }
.db-hint--info svg { color: #3182ce; }
.db-hint-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.db-hint-title { font-weight: 600; }
.db-hint-desc  { font-size: 0.71rem; opacity: .85; }

/* ── FINANZEN ────────────────────────────────────────────────── */
.db-finance-dl { margin: 0; }
.db-finance-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-light, #f0f2f5);
  gap: 8px;
  font-size: 0.78rem;
}
.db-finance-row:last-child { border-bottom: none; }
.db-finance-row dt { color: var(--text-muted, #718096); min-width: 0; }
.db-finance-row dd { margin: 0; font-weight: 600; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.db-finance-row dd a { color: var(--text-primary,#1a202c); text-decoration: none; }
.db-finance-row dd a:hover { color: var(--accent,#3182ce); text-decoration: underline; }
.db-finance-row--danger dt { color: #c53030; }
.db-finance-row--danger dd { color: #c53030; }
.db-finance-row--danger dd a { color: #c53030; }

/* ── AKTIVITÄTEN ─────────────────────────────────────────────── */
.db-activity-list { display: flex; flex-direction: column; gap: 0; }
.db-activity-item {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  gap: 6px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border-light,#f0f2f5);
  font-size: 0.73rem;
  align-items: center;
}
.db-activity-item:last-child { border-bottom: none; }
.db-activity-who  { font-weight: 600; color: var(--text-primary,#1a202c); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-activity-what { color: var(--text-secondary,#4a5568); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-activity-when { color: var(--text-muted,#718096); white-space: nowrap; text-align: right; font-size: 0.68rem; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .db-bottom-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .db-mid-grid { grid-template-columns: 1fr; }
  .db-bottom-grid { grid-template-columns: 1fr; }
  .db-kpi-row { gap: 6px; }
  .db-kpi { flex: 1 1 110px; }
}
@media (max-width: 600px) {
  #main-content { padding: 10px 10px 20px; gap: 10px; }
  .db-header { flex-direction: column; align-items: flex-start; }
  .db-kpi { flex: 1 1 calc(50% - 6px); }
  .db-activity-item { grid-template-columns: 80px 1fr; }
  .db-activity-when { display: none; }
}

/* ═══════════════════════════════════════════════════════════════
   Dashboard Widget Styles (dw- prefix)
   Verwendet von dashboard-widget-registry.js Renderern
   ═══════════════════════════════════════════════════════════════ */

/* ── KPI Row ───────────────────────────────────────────────── */
.dw-kpi-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.dw-kpi-row--4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.dw-kpi-card {
  flex: 1;
  min-width: 100px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  padding: 10px 14px;
  text-align: center;
}
.dw-kpi-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary, #1a202c);
  line-height: 1.2;
}
.dw-kpi-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted, #718096);
  margin-top: 2px;
}
.dw-kpi-sub {
  font-size: 10px;
  color: var(--text-muted, #718096);
  margin-top: 1px;
}
.dw-kpi-card--ok .dw-kpi-value { color: #0d7d3e; }
.dw-kpi-card--warn .dw-kpi-value { color: #b45309; }
.dw-kpi-card--danger .dw-kpi-value { color: #c0392b; }

/* ── Tables ────────────────────────────────────────────────── */
.dw-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.dw-table th {
  text-align: left;
  padding: 5px 8px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted, #718096);
  border-bottom: 2px solid var(--border, #e2e8f0);
}
.dw-table td {
  padding: 5px 8px;
  border-bottom: 1px solid #f0f2f5;
  vertical-align: middle;
}
.dw-table tbody tr:hover {
  background: #f8f9fa;
}
.dw-table a {
  color: var(--accent, #E73D25);
  text-decoration: none;
  font-weight: 500;
}
.dw-table a:hover { text-decoration: underline; }
.dw-text-right { text-align: right; }
.dw-text-danger { color: #c0392b; font-weight: 600; }

/* ── Quick Actions ─────────────────────────────────────────── */
.dw-quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.dw-quick-btn {
  padding: 8px 16px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 6px;
  background: var(--bg-card, #fff);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.dw-quick-btn:hover {
  background: #f0f4ff;
  border-color: var(--accent, #E73D25);
  color: var(--accent, #E73D25);
}

/* ── Lists ─────────────────────────────────────────────────── */
.dw-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.dw-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid #f0f2f5;
  font-size: 12px;
}
.dw-list-main { flex: 1; }
.dw-list-meta { color: var(--text-muted, #718096); font-size: 11px; }

/* ── Links ─────────────────────────────────────────────────── */
.dw-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--accent, #E73D25);
  text-decoration: none;
  font-weight: 500;
}
.dw-link:hover { text-decoration: underline; }

/* ── Badges ────────────────────────────────────────────────── */
.dw-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 500;
  background: #f0f0f0;
  color: #666;
}

/* ── Empty State ───────────────────────────────────────────── */
.dw-empty {
  text-align: center;
  padding: 16px;
  color: var(--text-muted, #718096);
  font-size: 12px;
  font-style: italic;
}

/* ── Responsive for KPI row ────────────────────────────────── */
@media (max-width: 900px) {
  .dw-kpi-row--4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .dw-kpi-row--4 { grid-template-columns: 1fr; }
}

