/**
 * Viverea Platform — gemeinsame UI-Schicht
 * Referenz: Rechnungen, Dashboard, Buchhaltung-Workbench, NK-Premium
 */

/* ── Seitenrahmen ── */
.vp-page {
  max-width: min(96vw, 1280px);
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  box-sizing: border-box;
}

.vp-page-hero {
  margin: 0 0 1.5rem;
}
.vp-page-hero h1 {
  margin: 0;
  font-size: clamp(1.5rem, 1.2rem + 1vw, 1.875rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  color: #0c1222;
  line-height: 1.15;
}
.vp-page-hero-lead {
  margin: 0.45rem 0 0;
  max-width: 40rem;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: #5c6578;
}

/* ── Toolbar ── */
.vp-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-end;
  margin-bottom: 1rem;
  padding: 0.55rem 0.7rem;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(12, 18, 34, 0.06);
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(12, 18, 34, 0.03);
}

/* ── Cards / Panels ── */
.vp-card {
  background: #fff;
  border: 1px solid rgba(12, 18, 34, 0.06);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(12, 18, 34, 0.04), 0 8px 24px rgba(12, 18, 34, 0.04);
}

.vp-card-head {
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid rgba(12, 18, 34, 0.06);
  font-size: 0.8125rem;
  font-weight: 600;
  color: #0c1222;
}

.vp-card-body {
  padding: 1rem 1.1rem;
}

/* ── Buttons ── */
.vp-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 40px;
  padding: 0 1rem;
  border-radius: 10px;
  border: none;
  background: #0c1222;
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(12, 18, 34, 0.1);
  transition: background 0.15s ease;
}
.vp-btn-primary:hover {
  background: #1a2332;
  color: #fff;
}

.vp-btn-secondary {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 0.9rem;
  border-radius: 10px;
  border: 1px solid rgba(12, 18, 34, 0.1);
  background: #fff;
  color: #334155;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.vp-btn-secondary:hover {
  background: #f8fafc;
}

/* ── Badges ── */
.vp-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.vp-pill--neutral { background: rgba(100, 116, 139, 0.1); color: #64748b; }
.vp-pill--ok { background: rgba(5, 150, 105, 0.08); color: #047857; }
.vp-pill--warn { background: rgba(202, 138, 4, 0.1); color: #92400e; }
.vp-pill--info { background: rgba(59, 130, 246, 0.08); color: #3b6fd4; }

/* ── Tabellen (Listen-Seiten) ── */
.vp-table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(12, 18, 34, 0.06);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(12, 18, 34, 0.03);
}

.vp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.vp-table th {
  padding: 0.65rem 0.85rem;
  text-align: left;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
  background: #f8fafc;
  border-bottom: 1px solid rgba(12, 18, 34, 0.06);
}

.vp-table td {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid rgba(12, 18, 34, 0.04);
  color: #334155;
  vertical-align: middle;
}

.vp-table tbody tr:hover td {
  background: rgba(59, 130, 246, 0.03);
}

.vp-table tbody tr:last-child td {
  border-bottom: none;
}

/* ── Empty State ── */
.vp-empty {
  text-align: center;
  padding: 2.5rem 1.5rem;
  border-radius: 16px;
  border: 1px dashed rgba(12, 18, 34, 0.1);
  background: rgba(255, 255, 255, 0.7);
}
.vp-empty-title {
  margin: 0 0 0.35rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #0c1222;
}
.vp-empty-text {
  margin: 0 auto;
  max-width: 22rem;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: #64748b;
}

/* ── Onboarding (Dashboard) ── */
.vp-onboarding {
  margin-bottom: 1.75rem;
  padding: 1.15rem 1.25rem 1.2rem;
  border-radius: 16px;
  border: 1px solid rgba(12, 18, 34, 0.06);
  background: linear-gradient(180deg, #fff 0%, #fafbfc 100%);
  box-shadow: 0 1px 2px rgba(12, 18, 34, 0.04);
}

.vp-onboarding[hidden] {
  display: none !important;
}

.vp-onboarding-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.vp-onboarding-head h2 {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #0c1222;
}

.vp-onboarding-head p {
  margin: 0.25rem 0 0;
  font-size: 0.8125rem;
  color: #64748b;
}

.vp-onboarding-dismiss {
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
}
.vp-onboarding-dismiss:hover {
  background: rgba(12, 18, 34, 0.04);
  color: #334155;
}

.vp-onboarding-steps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
  gap: 0.55rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.vp-onboarding-step {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  border: 1px solid rgba(12, 18, 34, 0.06);
  background: #fff;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.vp-onboarding-step:hover:not(.is-done) {
  border-color: rgba(59, 130, 246, 0.25);
  box-shadow: 0 2px 8px rgba(12, 18, 34, 0.05);
}

.vp-onboarding-step.is-done {
  opacity: 0.72;
  background: #f8fafc;
}

.vp-onboarding-num {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 700;
  background: rgba(12, 18, 34, 0.06);
  color: #64748b;
}

.vp-onboarding-step.is-done .vp-onboarding-num {
  background: rgba(5, 150, 105, 0.12);
  color: #047857;
}

.vp-onboarding-step.is-next .vp-onboarding-num {
  background: #0c1222;
  color: #fff;
}

.vp-onboarding-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #0c1222;
  line-height: 1.3;
}

.vp-onboarding-hint {
  font-size: 0.6875rem;
  color: #94a3b8;
  margin-top: 0.15rem;
}

/* ── Property Hub Thread Links ── */
.ph-thread-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.ph-thread-link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(12, 18, 34, 0.08);
  background: #fff;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.ph-thread-link:hover {
  background: #f8fafc;
  border-color: rgba(12, 18, 34, 0.14);
  color: #0c1222;
}

/* ── Listen-Seiten: alte page-head angleichen ── */
body.vp-unified .page-head-left h1 {
  font-size: clamp(1.5rem, 1.2rem + 1vw, 1.875rem);
  font-weight: 600;
  letter-spacing: -0.03em;
}

body.vp-unified .page-wrap,
body.vp-unified .main {
  background: #f6f7f9;
}

@media (max-width: 720px) {
  .vp-page {
    padding: 1.25rem 1rem 2rem;
  }
  .vp-onboarding-steps {
    grid-template-columns: 1fr;
  }

  /* Tabellen mit data-label → Kartenlayout */
  .vp-table-stack thead,
  .vp-table-wrap--stack thead {
    display: none;
  }

  .vp-table-stack tbody tr,
  .vp-table-wrap--stack tbody tr {
    display: block;
    margin-bottom: 0.65rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid rgba(12, 18, 34, 0.06);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(12, 18, 34, 0.04);
  }

  .vp-table-stack td,
  .vp-table-wrap--stack td {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.35rem 0;
    border: none;
    font-size: 0.8125rem;
  }

  .vp-table-stack td::before,
  .vp-table-wrap--stack td::before {
    content: attr(data-label);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #94a3b8;
    flex-shrink: 0;
    max-width: 46%;
  }

  .vp-table-stack td:not([data-label])::before,
  .vp-table-wrap--stack td:not([data-label])::before {
    display: none;
  }

  .vp-property-context {
    flex-direction: column;
    align-items: stretch;
  }
  .vp-property-context-actions {
    width: 100%;
  }
  .vp-property-context-actions .vp-btn-secondary {
    flex: 1 1 auto;
    justify-content: center;
  }
  .vp-roles-grid {
    grid-template-columns: 1fr;
  }
  body.vp-unified .filters {
    flex-direction: column;
  }
  body.vp-unified .filters .filter-input,
  body.vp-unified .filters .filter-select {
    width: 100%;
  }
}

/* ── Dashboard: Objekt-Kontext ── */
.vp-property-context {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  margin: 0 0 1.5rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(12, 18, 34, 0.06);
  background: #fff;
  box-shadow: 0 1px 2px rgba(12, 18, 34, 0.04);
}

.vp-property-context[hidden] {
  display: none !important;
}

.vp-property-context-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 0.2rem;
}

.vp-property-context-main strong {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #0c1222;
}

.vp-property-context-loc {
  display: block;
  font-size: 0.8125rem;
  color: #64748b;
  margin-top: 0.15rem;
}

.vp-property-context-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* ── Team: Rollen ── */
.vp-roles-panel {
  margin: 0 0 1.75rem;
  padding: 1rem 1.1rem;
  border-radius: 16px;
  border: 1px solid rgba(12, 18, 34, 0.06);
  background: #fff;
  box-shadow: 0 1px 2px rgba(12, 18, 34, 0.04);
}

.vp-roles-title {
  margin: 0 0 0.85rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #0c1222;
}

.vp-roles-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.vp-role-card {
  padding: 0.85rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(12, 18, 34, 0.06);
  background: #f8fafc;
}

.vp-role-card p {
  margin: 0.45rem 0 0.55rem;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: #64748b;
}

.vp-role-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.75rem;
  line-height: 1.55;
  color: #475569;
}

.vp-role-badge {
  display: inline-flex;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
}

.vp-role-badge--admin {
  background: rgba(12, 18, 34, 0.08);
  color: #0c1222;
}

.vp-role-badge--staff {
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
}

.vp-roles-note {
  margin: 0.85rem 0 0;
  font-size: 0.75rem;
  line-height: 1.5;
  color: #94a3b8;
}

.vp-role-hint {
  margin: 0.45rem 0 0;
  font-size: 0.75rem;
  line-height: 1.45;
  color: #64748b;
}

/* ── Debitoren-Modal: schlank ── */
.acc-deb-modal {
  width: min(520px, 96vw);
}

.acc-deb-pay-block {
  padding: 0 1rem 0.75rem;
}

.acc-deb-pay-toolbar {
  align-items: flex-end;
}

.acc-deb-pay-toolbar .acc-deb-ref {
  flex: 1 1 180px;
  min-width: 0;
}

.acc-deb-pay-btn {
  min-height: 40px;
}

.acc-deb-more {
  margin: 0 1rem 1rem;
  border: 1px solid rgba(12, 18, 34, 0.06);
  border-radius: 12px;
  background: #f8fafc;
}

.acc-deb-more summary {
  cursor: pointer;
  padding: 0.65rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #475569;
  list-style: none;
}

.acc-deb-more summary::-webkit-details-marker {
  display: none;
}

.acc-deb-more-body {
  padding: 0 0.85rem 0.85rem;
  border-top: 1px solid rgba(12, 18, 34, 0.06);
}

/* ── Listen-Seiten vereinheitlichen ── */
body.vp-unified .page-wrap {
  max-width: min(96vw, 1280px);
}

body.vp-unified .page-head-left h1,
body.vp-unified .mt-page-head h1 {
  font-size: clamp(1.5rem, 1.2rem + 1vw, 1.875rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  color: #0c1222;
}

body.vp-unified .page-head-left p,
body.vp-unified .mt-page-head p {
  font-size: 0.9375rem;
  line-height: 1.55;
  color: #64748b;
}

body.vp-unified .mt-toolbar,
body.vp-unified .filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-end;
  margin-bottom: 1rem;
  padding: 0.55rem 0.7rem;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(12, 18, 34, 0.06);
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(12, 18, 34, 0.03);
}

body.vp-unified .t-wrap,
body.vp-unified .vp-table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(12, 18, 34, 0.06);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(12, 18, 34, 0.03);
  -webkit-overflow-scrolling: touch;
}

body.vp-unified .t-table thead th {
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
  background: #f8fafc;
}

body.vp-unified .btn-p,
body.vp-unified .team-btn-primary {
  background: #0c1222;
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(12, 18, 34, 0.1);
}

body.vp-unified .v-empty {
  border-radius: 16px;
  border: 1px dashed rgba(12, 18, 34, 0.1);
}

/* Rechnungen: Mobile Toolbar */
@media (max-width: 720px) {
  body.inv-premium .inv-toolbar-row,
  body.inv-premium .inv-filter-row {
    flex-direction: column;
    align-items: stretch;
  }
  body.inv-premium .inv-filter-row select,
  body.inv-premium .inv-filter-row input {
    width: 100%;
  }
}

[data-theme="dark"] .vp-table-wrap,
[data-theme="dark"] .vp-onboarding {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

/* ── Brand Bridge: Landing → App ── */
.vp-page-hero h1,
.dash-hero-title,
.vp-onboarding-head h2,
h1.page-title {
  font-family: var(--font-display, "Inter Tight", "Inter", system-ui, sans-serif);
  letter-spacing: -0.03em;
}

.dash-hero-sub {
  margin: 0.5rem 0 0;
  max-width: 32rem;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: #6b7280;
}

.vp-btn-primary {
  background: var(--accent, #2997ff);
}
.vp-btn-primary:hover {
  background: var(--accent-hover, #1a85e8);
}
