/* Einhell AI Abrechnung – Admin UI (Bootstrap 5.3 Overrides) */

:root {
  --brand: #c8102e;
  --brand-600: #a90d27;
  --brand-50: #fdf1f3;
  --ink: #15191e;
  --ink-2: #3a424d;
  --muted: #6b7480;
  --line: #e4e7eb;
  --line-2: #eef0f3;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --sidebar: #12161b;
  --sidebar-2: #1b2128;
  --sidebar-ink: #a7b0bb;
  --ok: #157f4b;
  --ok-50: #e8f6ee;
  --warn: #9a6200;
  --warn-50: #fff5e0;
  --radius: 10px;
  --radius-sm: 7px;

  --bs-body-font-family: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-font-size: .875rem;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--surface);
  --bs-border-color: var(--line);
  --bs-border-radius: var(--radius-sm);
  --bs-border-radius-lg: var(--radius);
  --bs-link-color: var(--brand);
  --bs-link-color-rgb: 200, 16, 46;
  --bs-link-hover-color: var(--brand-600);
  --bs-primary: var(--brand);
  --bs-primary-rgb: 200, 16, 46;
  --bs-focus-ring-color: rgba(200, 16, 46, .2);
  --bs-secondary-color: var(--muted);
}

html, body { height: 100%; }
body { background-color: var(--bg); }
body { -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 0; }
h1, h2, h3, h4, h5, h6 { font-weight: 700; letter-spacing: -.01em; color: var(--ink); }
.text-muted, .text-secondary { color: var(--muted) !important; }
.tabular, .money, td.num, th.num { font-variant-numeric: tabular-nums; }
.num { text-align: right; white-space: nowrap; }
.money { white-space: nowrap; }
.money-neg { color: var(--brand); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8125rem; }
code { color: var(--ink-2); background: var(--line-2); padding: .1rem .35rem; border-radius: 5px; }

/* ---------- Shell ---------- */
.app { display: flex; min-height: 100vh; }
.app-sidebar {
  --bs-offcanvas-width: 248px;
  --bs-offcanvas-bg: var(--sidebar);
  background: var(--sidebar);
  color: var(--sidebar-ink);
  display: flex; flex-direction: column;
}
@media (min-width: 992px) {
  /* Bootstrap .offcanvas-lg setzt ab lg transparent/auto mit !important → überschreiben */
  .app-sidebar.offcanvas-lg { width: 232px !important; flex: 0 0 232px; position: sticky; top: 0; height: 100vh !important; background-color: var(--sidebar) !important; }
}
.app-brand { display: flex; align-items: center; gap: .7rem; padding: 1.1rem 1.1rem 1rem; border-bottom: 1px solid rgba(255,255,255,.06); }
.app-brand-mark { width: 32px; height: 32px; flex: 0 0 32px; display: block; border-radius: 0; }
.app-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.app-brand-text strong { color: #fff; font-size: .9rem; font-weight: 700; }
.app-brand-text small { color: #77818d; font-size: .7rem; font-weight: 500; }
.app-nav { padding: .75rem .6rem; display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; }
.app-nav-link {
  display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: 7px;
  color: var(--sidebar-ink); text-decoration: none; font-weight: 600; font-size: .85rem;
  background: none; border: 0; text-align: left; position: relative;
}
.app-nav-link i { font-size: 1rem; width: 18px; text-align: center; opacity: .85; }
.nav-badge { margin-left: auto; background: var(--brand); color: #fff; font-size: .65rem; font-weight: 800; border-radius: 999px; padding: .05rem .45rem; }
.app-nav-link:hover { color: #fff; background: var(--sidebar-2); }
.app-nav-link.active { color: #fff; background: var(--sidebar-2); }
.app-nav-link.active::before {
  content: ""; position: absolute; left: -.6rem; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand);
}
.app-sidebar-foot { padding: .75rem .6rem 1rem; border-top: 1px solid rgba(255,255,255,.06); }
.app-user { display: flex; align-items: center; gap: .6rem; padding: .35rem .7rem .6rem; color: #8b95a1; font-size: .78rem; min-width: 0; }
.app-logout:hover { color: #fff; }

.app-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.app-topbar {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  padding: .9rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1020;
}
.app-title { min-width: 0; flex: 1 1 0; }
.app-title h1 { font-size: 1.125rem; margin: 0; line-height: 1.3; }
.app-subtitle { color: var(--muted); font-size: .78rem; margin-top: 1px; }
.app-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.app-content { padding: 1.5rem; flex: 1 1 auto; }
.btn-icon { width: 36px; height: 36px; padding: 0; display: inline-grid; place-items: center; font-size: 1.35rem; border-radius: 8px; color: var(--ink); }
.btn-icon:hover { background: var(--line-2); }

@media (max-width: 991.98px) {
  .app-topbar { padding: .7rem 1rem; }
  .app-content { padding: 1rem; }
}
@media (max-width: 575.98px) {
  .app-topbar { position: static; }
  .app-actions { width: 100%; }
  .app-actions > * { flex: 1 1 auto; }
}

/* ---------- Cards / Panels ---------- */
.card { --bs-card-border-color: var(--line); --bs-card-border-radius: var(--radius); --bs-card-cap-bg: transparent; box-shadow: 0 1px 2px rgba(16,24,40,.03); }
.card-header { display: flex; align-items: center; gap: .75rem; padding: .85rem 1.1rem; border-bottom: 1px solid var(--line); }
.card-header h2, .card-title-sm { font-size: .9rem; margin: 0; font-weight: 700; }
.card-header .card-hint { color: var(--muted); font-size: .75rem; margin-left: auto; }
.card-body { padding: 1.1rem; }
.section-title { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 .6rem; }

/* KPI-Kacheln */
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; height: 100%; }
.kpi-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; align-items: center; gap: .4rem; }
.kpi-value { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; margin-top: .3rem; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi-sub { font-size: .75rem; color: var(--muted); margin-top: .2rem; }
.kpi-accent { border-left: 3px solid var(--brand); }

/* ---------- Tabellen ---------- */
.table-app { --bs-table-bg: transparent; --bs-table-hover-bg: #f8f9fb; margin: 0; font-size: .8125rem; }
.table-app > thead > tr > th {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  background: #fafbfc; border-bottom: 1px solid var(--line); padding: .6rem .85rem; white-space: nowrap;
}
.table-app > tbody > tr > td { padding: .6rem .85rem; border-color: var(--line-2); vertical-align: middle; }
.table-app > tfoot > tr > td { padding: .65rem .85rem; font-weight: 700; border-top: 1px solid var(--line); border-bottom: 0; background: #fafbfc; }
.table-app tr:last-child > td { border-bottom: 0; }
.table-app .row-muted td { color: var(--muted); }
.table-app .row-correction td { background: var(--brand-50); }
.table-app .cell-sub { display: block; color: var(--muted); font-size: .72rem; line-height: 1.3; }
.table-app .cell-actions { text-align: right; white-space: nowrap; width: 1%; }
.table-responsive { position: relative; }
.card > .table-responsive:first-child, .card > .table-responsive:last-child { border-radius: var(--radius); }
.card .table-responsive + .card-footer { border-top: 1px solid var(--line); }
.card-footer { background: var(--surface); padding: .7rem 1.1rem; display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }

/* Bar in Tabellen (Anteil) */
.share-bar { height: 6px; background: var(--line-2); border-radius: 3px; overflow: hidden; min-width: 60px; }
.share-bar > span { display: block; height: 100%; background: var(--brand); border-radius: 3px; }

/* ---------- Badges ---------- */
.badge-status { display: inline-flex; align-items: center; gap: .3rem; font-size: .7rem; font-weight: 700; padding: .2rem .5rem; border-radius: 999px; }
.badge-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-on { color: var(--ok); background: var(--ok-50); }
.badge-off { color: var(--muted); background: var(--line-2); }
.badge-warn { color: var(--warn); background: var(--warn-50); }
.badge-brand { color: var(--brand); background: var(--brand-50); }
.badge-soft { display: inline-block; font-size: .7rem; font-weight: 600; padding: .15rem .45rem; border-radius: 5px; background: var(--line-2); color: var(--ink-2); }

/* ---------- Buttons / Forms ---------- */
.btn { --bs-btn-font-weight: 600; --bs-btn-font-size: .8125rem; --bs-btn-padding-y: .45rem; --bs-btn-padding-x: .85rem; --bs-btn-border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
.btn-sm { --bs-btn-font-size: .75rem; --bs-btn-padding-y: .28rem; --bs-btn-padding-x: .6rem; --bs-btn-border-radius: 6px; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: var(--brand-600); --bs-btn-active-bg: var(--brand-600); --bs-btn-active-border-color: var(--brand-600); --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand); }
.btn-danger { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: var(--brand-600); --bs-btn-active-bg: var(--brand-600); --bs-btn-active-border-color: var(--brand-600); }
.btn-dark { --bs-btn-bg: var(--ink); --bs-btn-border-color: var(--ink); }
.btn-light { --bs-btn-bg: #fff; --bs-btn-border-color: var(--line); --bs-btn-hover-bg: #f6f7f9; --bs-btn-hover-border-color: #d5d9de; --bs-btn-color: var(--ink); }
.btn-ghost { --bs-btn-color: var(--ink-2); --bs-btn-hover-bg: var(--line-2); --bs-btn-hover-color: var(--ink); --bs-btn-border-color: transparent; --bs-btn-hover-border-color: transparent; }
.btn-ghost-danger { --bs-btn-color: var(--brand); --bs-btn-hover-bg: var(--brand-50); --bs-btn-hover-color: var(--brand-600); --bs-btn-border-color: transparent; --bs-btn-hover-border-color: transparent; }
.form-control, .form-select { font-size: .8125rem; border-color: var(--line); border-radius: 7px; padding: .45rem .7rem; }
.form-select { padding-right: 2rem; }
.form-control-sm, .form-select-sm { font-size: .78rem; padding-top: .3rem; padding-bottom: .3rem; }
.form-control:focus, .form-select:focus { border-color: rgba(200,16,46,.5); box-shadow: 0 0 0 .2rem rgba(200,16,46,.12); }
.form-label { font-size: .75rem; font-weight: 700; color: var(--ink-2); margin-bottom: .3rem; }
.form-text { font-size: .72rem; color: var(--muted); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.input-group-text { font-size: .8125rem; background: #fafbfc; border-color: var(--line); }

/* Filterleiste */
.filter-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; align-items: end; }
.filter-bar .filter-actions { display: flex; gap: .4rem; }

/* ---------- Modals / Toasts ---------- */
.modal-content { border: 0; border-radius: 12px; box-shadow: 0 20px 50px rgba(16,24,40,.18); }
.modal-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.modal-body { padding: 1.25rem; }
.modal-footer { padding: .8rem 1.25rem; border-top: 1px solid var(--line); gap: .4rem; }
.toast-container { z-index: 1090; }
.app-toast { border: 0; border-radius: 10px; box-shadow: 0 10px 30px rgba(16,24,40,.16); font-size: .8125rem; font-weight: 500; background: #fff; border-left: 4px solid var(--muted); }
.app-toast .flex-grow-1, #confirmModal .modal-body, .callout, .empty-text { overflow-wrap: anywhere; }
.app-toast i.bi { font-size: 1rem; margin-top: 1px; }
.app-toast-success { border-left-color: var(--ok); } .app-toast-success i.bi { color: var(--ok); }
.app-toast-danger { border-left-color: var(--brand); } .app-toast-danger i.bi { color: var(--brand); }
.app-toast-warning { border-left-color: #d99400; } .app-toast-warning i.bi { color: #d99400; }
.app-toast-info i.bi { color: #2f6fde; }

/* Secret-/Key-Anzeige */
.secret-box { display: flex; gap: .5rem; align-items: stretch; }
.secret-box input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; background: #fafbfc; }

/* Hinweisbox */
.callout { border: 1px solid var(--line); border-left: 3px solid var(--brand); background: var(--surface); border-radius: var(--radius-sm); padding: .8rem 1rem; font-size: .8125rem; }
.callout-warn { border-left-color: #d99400; background: var(--warn-50); }
.callout-ok { border-left-color: var(--ok); background: var(--ok-50); }

/* Empty State */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty-state > i.bi { font-size: 1.8rem; color: #b5bcc5; display: block; margin-bottom: .5rem; }
.empty-title { font-weight: 700; color: var(--ink-2); }
.empty-text { font-size: .8rem; margin-top: .2rem; }
.empty-state .btn { margin-top: .9rem; }

/* Pagination */
.pagination { --bs-pagination-color: var(--ink-2); --bs-pagination-active-bg: var(--ink); --bs-pagination-active-border-color: var(--ink); --bs-pagination-border-color: var(--line); --bs-pagination-hover-bg: var(--line-2); --bs-pagination-focus-box-shadow: 0 0 0 .2rem rgba(200,16,46,.12); }

/* Chart */
.chart-box { position: relative; height: 260px; }

/* ---------- Login ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: radial-gradient(1200px 500px at 10% -10%, #fbe9ec 0, transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 2rem 1.75rem; box-shadow: 0 10px 30px rgba(16,24,40,.06); }
.auth-card .app-brand-mark { width: 44px; height: 44px; }
.auth-card h1 { font-size: 1.2rem; margin: 1rem 0 .25rem; }

/* Utilities */
.gap-row { row-gap: 1rem; }
.w-1 { width: 1%; }
.text-brand { color: var(--brand) !important; }
.fw-800 { font-weight: 800; }
.small-muted { font-size: .75rem; color: var(--muted); }
