/**
 * Waveflow Client Portal – Design System
 * v3.0.0
 *
 * Sections:
 *   1. Tokens (inherit from theme, portal-specific overrides)
 *   2. Portal Shell (header, nav, avatar)
 *   3. Tab Navigation + Mobile Bottom Bar
 *   4. Dashboard (KPI cards, activity feed, quick actions)
 *   5. Ticket Cards + Tabs
 *   6. Ticket Detail / Chat Thread
 *   7. Invoice Cards + Tabs
 *   8. Profile Page
 *   9. Login / Password Pages
 *  10. Forms + Inputs
 *  11. Empty States
 *  12. Utilities + Animations
 */

/* Prevent scrollbar layout-shift on portal pages */
html {
  scrollbar-gutter: stable;
}

/* =========================================
   1. TOKENS
   ========================================= */
:root {
  --wfp-bg: var(--bg, #f5f0e8);
  --wfp-bg-alt: var(--bg-alt, #ece6dc);
  --wfp-text: var(--text, #2b2d33);
  --wfp-muted: var(--muted, #7a7d85);
  --wfp-accent: var(--accent, #3b82f6);
  --wfp-accent-2: var(--accent-2, #06b6d4);
  --wfp-card-bg: var(--card-bg, #ffffff);
  --wfp-card-border: var(--card-border, #d6cfc5);
  --wfp-line: var(--line, rgba(0,0,0,.10));
  --wfp-radius: 16px;
  --wfp-radius-sm: 12px;
  --wfp-radius-xs: 8px;
  --wfp-shadow: 0 4px 24px rgba(0,0,0,.08);
  --wfp-shadow-lg: 0 12px 40px rgba(0,0,0,.12);
  --wfp-gradient: linear-gradient(135deg, var(--wfp-accent), var(--wfp-accent-2));
  --wfp-success: #10b981;
  --wfp-warning: #f59e0b;
  --wfp-danger: #ef4444;
  --wfp-max-w: 1080px;
  --wfp-shell-h: 58px;
  --wfp-bottom-bar-h: 64px;
  --wfp-transition: .2s ease;
}


/* =========================================
   2. PORTAL SHELL
   ========================================= */
.wfp-shell *,
.wfp-shell *::before,
.wfp-shell *::after {
  box-sizing: border-box;
}

.wfp-shell {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* Horizontal overflow auf Body-Ebene statt Shell (verhindert zweiten Scrollbar) */
body.wfp-portal-page {
  overflow-x: hidden;
}

/* Portal Header */
.wfp-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--wfp-shell-h);
  background: rgba(245, 240, 232, .90);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--wfp-line);
}

.wfp-header-inner {
  max-width: var(--wfp-max-w);
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.wfp-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wfp-header-left a {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--wfp-text);
}

.wfp-header-left .logo img,
.wfp-header-left .logo svg {
  height: 28px;
  width: auto;
  border-radius: 8px;
}

.wfp-header-left .wfp-header-title {
  font-size: 15px;
  font-weight: 600;
  opacity: .7;
  color: var(--wfp-muted);
}

.wfp-header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Avatar (Initialen-Kreis) */
.wfp-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--wfp-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.wfp-user-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--wfp-text);
}

.wfp-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0,0,0,.04);
  border: 1px solid var(--wfp-line);
  color: var(--wfp-muted);
  text-decoration: none;
  transition: background var(--wfp-transition), color var(--wfp-transition);
}

.wfp-logout:hover {
  background: rgba(239,68,68,.12);
  color: var(--wfp-danger);
}


/* =========================================
   3. INLINE TAB NAVIGATION + MOBILE BOTTOM BAR
   ========================================= */

/* Inline nav inside the header */
.wfp-header-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.wfp-nav-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--wfp-muted);
  text-decoration: none;
  border-radius: var(--wfp-radius-xs);
  transition: color var(--wfp-transition), background var(--wfp-transition);
  white-space: nowrap;
}

.wfp-nav-tab:hover {
  color: var(--wfp-text);
  background: rgba(0,0,0,.04);
}

.wfp-nav-tab.active {
  color: var(--wfp-accent);
  background: rgba(59,130,246,.1);
}

.wfp-nav-tab svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Mobile Bottom Bar */
.wfp-bottom-bar {
  display: none;
}

@media (max-width: 768px) {
  .wfp-header-nav {
    display: none;
  }

  .wfp-bottom-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    height: var(--wfp-bottom-bar-h);
    background: rgba(255, 255, 255, .97);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border-top: 1px solid var(--wfp-line);
    justify-content: space-around;
    align-items: center;
    padding: 0 8px;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .wfp-bottom-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 500;
    color: var(--wfp-muted);
    text-decoration: none;
    transition: color var(--wfp-transition);
    -webkit-tap-highlight-color: transparent;
  }

  .wfp-bottom-tab svg {
    width: 22px;
    height: 22px;
  }

  .wfp-bottom-tab.active {
    color: var(--wfp-accent);
  }

  .wfp-shell-content {
    padding-bottom: calc(var(--wfp-bottom-bar-h) + env(safe-area-inset-bottom, 0) + 16px) !important;
  }
}


/* =========================================
   4. DASHBOARD
   ========================================= */
.wfp-shell-content {
  flex: 1;
  max-width: var(--wfp-max-w);
  width: 100%;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

.wfp-greeting {
  margin: 0 0 8px;
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 700;
  color: var(--wfp-text);
}

.wfp-subtitle {
  margin: 0 0 28px;
  font-size: 16px;
  color: var(--wfp-muted);
}

/* KPI Cards */
.wfp-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.wfp-kpi {
  background: var(--wfp-card-bg);
  border: 1px solid var(--wfp-card-border);
  border-radius: var(--wfp-radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color var(--wfp-transition), transform var(--wfp-transition);
}

.wfp-kpi:hover {
  border-color: rgba(148,163,184,.35);
  transform: translateY(-2px);
}

.wfp-kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--wfp-radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
}

.wfp-kpi-icon svg {
  width: 20px;
  height: 20px;
}

.wfp-kpi-icon--tickets {
  background: rgba(59,130,246,.12);
  color: var(--wfp-accent);
}

.wfp-kpi-icon--invoices {
  background: rgba(245,158,11,.12);
  color: var(--wfp-warning);
}

.wfp-kpi-icon--status {
  background: rgba(16,185,129,.12);
  color: var(--wfp-success);
}

.wfp-kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--wfp-text);
  line-height: 1;
}

.wfp-kpi-label {
  font-size: 14px;
  color: var(--wfp-muted);
}

.wfp-kpi-link {
  font-size: 13px;
  color: var(--wfp-accent);
  text-decoration: none;
  font-weight: 500;
  margin-top: 4px;
}

.wfp-kpi-link:hover {
  text-decoration: underline;
}

/* Activity Feed */
.wfp-section-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--wfp-text);
  margin: 0 0 16px;
}

.wfp-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 32px;
}

.wfp-feed-item {
  display: flex;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--wfp-line);
}

.wfp-feed-item:last-child {
  border-bottom: 0;
}

.wfp-feed-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
}

.wfp-feed-dot--comment      { background: var(--wfp-accent); }
.wfp-feed-dot--closed       { background: var(--wfp-success); }
.wfp-feed-dot--invoice      { background: var(--wfp-warning); }
.wfp-feed-dot--invoice_paid { background: var(--wfp-success); }
.wfp-feed-dot--status       { background: var(--wfp-accent-2); }

.wfp-feed-content {
  flex: 1;
  min-width: 0;
}

.wfp-feed-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--wfp-text);
  margin: 0 0 4px;
}

.wfp-feed-title a {
  color: var(--wfp-accent);
  text-decoration: none;
}

.wfp-feed-title a:hover {
  text-decoration: underline;
}

.wfp-feed-excerpt {
  font-size: 13px;
  color: var(--wfp-muted);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wfp-feed-time {
  font-size: 12px;
  color: var(--wfp-muted);
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}

/* Quick Actions */
.wfp-quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  gap: 12px;
}

.wfp-quick-action {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--wfp-card-bg);
  border: 1px solid var(--wfp-card-border);
  border-radius: var(--wfp-radius-sm);
  color: var(--wfp-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: border-color var(--wfp-transition), background var(--wfp-transition);
}

.wfp-quick-action:hover {
  border-color: var(--wfp-accent);
  background: rgba(59,130,246,.06);
}

.wfp-quick-action svg {
  width: 18px;
  height: 18px;
  color: var(--wfp-accent);
  flex-shrink: 0;
}


/* =========================================
   5. TICKET CARDS + TABS
   ========================================= */
.wfp-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--wfp-line);
}

.wfp-tab {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--wfp-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color var(--wfp-transition), border-color var(--wfp-transition);
}

.wfp-tab:hover {
  color: var(--wfp-text);
}

.wfp-tab.active {
  color: var(--wfp-accent);
  border-bottom-color: var(--wfp-accent);
}

.wfp-tab-panel {
  display: none;
}

.wfp-tab-panel.active {
  display: block;
}

/* Ticket Cards Grid */
.wfp-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 16px;
}

.wfp-ticket-card {
  background: var(--wfp-card-bg);
  border: 1px solid var(--wfp-card-border);
  border-radius: var(--wfp-radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color var(--wfp-transition), transform var(--wfp-transition), box-shadow var(--wfp-transition);
}

.wfp-ticket-card:hover {
  border-color: rgba(148,163,184,.35);
  transform: translateY(-2px);
  box-shadow: var(--wfp-shadow);
}

.wfp-ticket-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.wfp-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.wfp-status--offen {
  background: rgba(59,130,246,.12);
  color: #3b82f6;
  border: 1px solid rgba(59,130,246,.25);
}

.wfp-status--in-bearbeitung {
  background: rgba(245,158,11,.12);
  color: #d97706;
  border: 1px solid rgba(245,158,11,.25);
}

.wfp-status--geschlossen {
  background: rgba(16,185,129,.10);
  color: #16a34a;
  border: 1px solid rgba(16,185,129,.25);
}

.wfp-ticket-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--wfp-text);
  margin: 0;
  line-height: 1.4;
}

.wfp-ticket-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--wfp-muted);
}

.wfp-ticket-meta svg {
  width: 14px;
  height: 14px;
  margin-right: 4px;
  vertical-align: -2px;
}

.wfp-ticket-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--wfp-accent);
  text-decoration: none;
  margin-top: auto;
  padding-top: 4px;
}

.wfp-ticket-action:hover {
  text-decoration: underline;
}


/* =========================================
   6. TICKET DETAIL / CHAT THREAD
   ========================================= */
.wfp-ticket-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.wfp-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--wfp-muted);
  text-decoration: none;
  transition: color var(--wfp-transition);
}

.wfp-back-link:hover {
  color: var(--wfp-text);
}

.wfp-back-link svg {
  width: 18px;
  height: 18px;
}

.wfp-ticket-header h1 {
  font-size: clamp(18px, 3vw, 24px);
  font-weight: 700;
  margin: 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Chat Thread */
.wfp-chat {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.wfp-chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 80%;
}

.wfp-chat-msg--customer {
  align-self: flex-start;
}

.wfp-chat-msg--support {
  align-self: flex-end;
}

.wfp-chat-bubble {
  padding: 14px 18px;
  border-radius: var(--wfp-radius);
  font-size: 15px;
  line-height: 1.6;
  word-break: break-word;
}

.wfp-chat-msg--customer .wfp-chat-bubble {
  background: var(--wfp-card-bg);
  border: 1px solid var(--wfp-card-border);
  border-bottom-left-radius: 4px;
}

.wfp-chat-msg--support .wfp-chat-bubble {
  background: rgba(59,130,246,.12);
  border: 1px solid rgba(59,130,246,.2);
  border-bottom-right-radius: 4px;
}

.wfp-chat-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--wfp-muted);
  margin-top: 6px;
  padding: 0 4px;
}

.wfp-chat-msg--support .wfp-chat-meta {
  justify-content: flex-end;
}

/* Description block (first message / ticket content) */
.wfp-ticket-description {
  background: var(--wfp-card-bg);
  border: 1px solid var(--wfp-card-border);
  border-radius: var(--wfp-radius);
  padding: 20px;
  margin-bottom: 24px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--wfp-text);
}

.wfp-ticket-description p:first-child { margin-top: 0; }
.wfp-ticket-description p:last-child  { margin-bottom: 0; }

/* Comment form at bottom */
.wfp-chat-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: var(--wfp-card-bg);
  border: 1px solid var(--wfp-card-border);
  border-radius: var(--wfp-radius);
  padding: 12px;
}

.wfp-chat-form textarea {
  flex: 1;
  min-height: 44px;
  max-height: 160px;
  padding: 10px 14px;
  border: 1px solid var(--wfp-line);
  border-radius: var(--wfp-radius-sm);
  background: rgba(0,0,0,.02);
  color: var(--wfp-text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
}

.wfp-chat-form textarea::placeholder {
  color: var(--wfp-muted);
  opacity: .7;
}

.wfp-chat-form textarea:focus {
  outline: none;
  border-color: var(--wfp-accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

.wfp-chat-send {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--wfp-gradient);
  border: none;
  border-radius: var(--wfp-radius-sm);
  color: #fff;
  cursor: pointer;
  transition: opacity var(--wfp-transition), transform var(--wfp-transition);
}

.wfp-chat-send:hover {
  opacity: .9;
  transform: scale(1.04);
}

.wfp-chat-send:disabled {
  opacity: .4;
  cursor: not-allowed;
  transform: none;
}

.wfp-chat-send svg {
  width: 20px;
  height: 20px;
}


/* =========================================
   7. INVOICE CARDS + TABS
   ========================================= */
.wfp-invoice-card {
  background: var(--wfp-card-bg);
  border: 1px solid var(--wfp-card-border);
  border-radius: var(--wfp-radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color var(--wfp-transition), transform var(--wfp-transition), box-shadow var(--wfp-transition);
}

.wfp-invoice-card:hover {
  border-color: rgba(148,163,184,.35);
  transform: translateY(-2px);
  box-shadow: var(--wfp-shadow);
}

.wfp-invoice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.wfp-invoice-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--wfp-text);
  margin: 0;
}

.wfp-invoice-amount {
  font-size: 24px;
  font-weight: 700;
  color: var(--wfp-text);
}

.wfp-invoice-date {
  font-size: 13px;
  color: var(--wfp-muted);
}

.wfp-invoice-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.wfp-invoice-actions a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: var(--wfp-radius-xs);
  transition: background var(--wfp-transition);
}

.wfp-btn-download {
  background: rgba(59,130,246,.1);
  color: var(--wfp-accent);
  border: 1px solid rgba(59,130,246,.2);
}

.wfp-btn-download:hover {
  background: rgba(59,130,246,.18);
}

.wfp-btn-download svg {
  width: 16px;
  height: 16px;
}


/* =========================================
   8. PROFILE PAGE
   ========================================= */
.wfp-profile-section {
  background: var(--wfp-card-bg);
  border: 1px solid var(--wfp-card-border);
  border-radius: var(--wfp-radius);
  padding: 24px;
  margin-bottom: 20px;
}

.wfp-profile-section h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 18px;
  color: var(--wfp-text);
}

.wfp-profile-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--wfp-line);
}

.wfp-profile-row:last-child {
  border-bottom: 0;
}

.wfp-profile-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--wfp-muted);
}

.wfp-profile-value {
  font-size: 15px;
  color: var(--wfp-text);
}

@media (max-width: 520px) {
  .wfp-profile-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}


/* =========================================
   9. LOGIN / PASSWORD PAGES
   ========================================= */
.wfp-auth-wrapper {
  min-height: calc(100vh - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.wfp-auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--wfp-card-bg);
  border: 1px solid var(--wfp-card-border);
  border-radius: var(--wfp-radius);
  padding: 36px 32px;
  box-shadow: var(--wfp-shadow-lg);
}

.wfp-auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.wfp-auth-logo svg,
.wfp-auth-logo img {
  height: 40px;
  width: auto;
}

.wfp-auth-title {
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  margin: 0 0 6px;
  color: var(--wfp-text);
}

.wfp-auth-subtitle {
  font-size: 15px;
  text-align: center;
  color: var(--wfp-muted);
  margin: 0 0 28px;
}

.wfp-auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--wfp-muted);
}

.wfp-auth-footer a {
  color: var(--wfp-accent);
  text-decoration: none;
}

.wfp-auth-footer a:hover {
  text-decoration: underline;
}


/* =========================================
   10. FORMS + INPUTS
   ========================================= */
.wfp-form-group {
  margin-bottom: 18px;
}

.wfp-form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--wfp-text);
  margin-bottom: 6px;
}

.wfp-input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  color: var(--wfp-text);
  background: rgba(0,0,0,.02);
  border: 1px solid var(--wfp-line);
  border-radius: var(--wfp-radius-sm);
  transition: border-color var(--wfp-transition), box-shadow var(--wfp-transition);
}

select.wfp-input {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a7d85' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  cursor: pointer;
}

.wfp-input::placeholder {
  color: var(--wfp-muted);
  opacity: .6;
}

.wfp-input:focus {
  outline: none;
  border-color: var(--wfp-accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

/* Password field with toggle */
.wfp-pw-wrap {
  position: relative;
}

.wfp-pw-wrap .wfp-input {
  padding-right: 48px;
}

.wfp-pw-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--wfp-muted);
  cursor: pointer;
  border-radius: var(--wfp-radius-xs);
  transition: color var(--wfp-transition);
}

.wfp-pw-toggle:hover {
  color: var(--wfp-text);
}

.wfp-pw-toggle svg {
  width: 20px;
  height: 20px;
}

/* Primary Button */
.wfp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 20px;
  box-sizing: border-box;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--wfp-gradient);
  border: none;
  border-radius: var(--wfp-radius-sm);
  cursor: pointer;
  transition: opacity var(--wfp-transition), transform var(--wfp-transition);
}

.wfp-btn:hover {
  opacity: .9;
  transform: translateY(-1px);
}

.wfp-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

.wfp-btn--ghost {
  background: none;
  color: var(--wfp-accent);
  border: 1px solid rgba(59,130,246,.3);
}

.wfp-btn--ghost:hover {
  background: rgba(59,130,246,.08);
  opacity: 1;
}

.wfp-btn--danger {
  background: linear-gradient(135deg, #ef4444, #f97316);
}

.wfp-btn--sm {
  width: auto;
  padding: 10px 16px;
  font-size: 14px;
}

/* Alert/Message Banners */
.wfp-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--wfp-radius-sm);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 20px;
}
.wfp-alert[hidden] { display: none; }

.wfp-alert svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.wfp-alert--error {
  background: rgba(239,68,68,.08);
  border: 1px solid rgba(239,68,68,.25);
  color: #dc2626;
}

.wfp-alert--success {
  background: rgba(16,185,129,.08);
  border: 1px solid rgba(16,185,129,.25);
  color: #16a34a;
}

.wfp-alert--info {
  background: rgba(59,130,246,.08);
  border: 1px solid rgba(59,130,246,.25);
  color: #2563eb;
}

/* WP Login form overrides (inside auth card) */
.wfp-auth-card #loginform p {
  margin: 0 0 16px;
}

.wfp-auth-card #loginform label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--wfp-text);
  margin-bottom: 6px;
}

.wfp-auth-card #loginform input[type="text"],
.wfp-auth-card #loginform input[type="password"],
.wfp-auth-card #loginform input[type="email"] {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  color: var(--wfp-text);
  background: rgba(0,0,0,.02);
  border: 1px solid var(--wfp-line);
  border-radius: var(--wfp-radius-sm);
  transition: border-color var(--wfp-transition), box-shadow var(--wfp-transition);
}

.wfp-auth-card #loginform input[type="text"]:focus,
.wfp-auth-card #loginform input[type="password"]:focus,
.wfp-auth-card #loginform input[type="email"]:focus {
  outline: none;
  border-color: var(--wfp-accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

.wfp-auth-card .login-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
}

.wfp-auth-card .login-remember input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--wfp-accent);
}

.wfp-auth-card .login-submit {
  margin: 0;
}

.wfp-auth-card .login-submit input[type="submit"],
.wfp-auth-card .login-submit .button-primary {
  width: 100%;
  padding: 13px 20px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--wfp-gradient);
  border: none;
  border-radius: var(--wfp-radius-sm);
  cursor: pointer;
  transition: opacity var(--wfp-transition), transform var(--wfp-transition);
}

.wfp-auth-card .login-submit input[type="submit"]:hover {
  opacity: .9;
  transform: translateY(-1px);
}


/* =========================================
   11. EMPTY STATES
   ========================================= */
.wfp-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.wfp-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(59,130,246,.08);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.wfp-empty-icon svg {
  width: 28px;
  height: 28px;
  color: var(--wfp-accent);
}

.wfp-empty h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--wfp-text);
  margin: 0 0 8px;
}

.wfp-empty p {
  font-size: 14px;
  color: var(--wfp-muted);
  margin: 0;
  max-width: 380px;
}


/* =========================================
   12. UTILITIES + ANIMATIONS
   ========================================= */
.wfp-divider {
  height: 1px;
  background: var(--wfp-line);
  margin: 24px 0;
}

@keyframes wfpFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.wfp-animate-in {
  animation: wfpFadeIn .3s ease both;
}

/* Loading spinner */
.wfp-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(0,0,0,.12);
  border-top-color: var(--wfp-accent);
  border-radius: 50%;
  animation: wfpSpin .6s linear infinite;
}

@keyframes wfpSpin {
  to { transform: rotate(360deg); }
}

/* Hide main site header/footer on portal pages (optional, controlled via body class) */
body.wfp-portal-page .header,
body.wfp-portal-page .footer {
  display: none;
}

body.wfp-portal-page main {
  padding: 0;
  margin: 0;
}

/* Responsive helpers */
@media (max-width: 640px) {
  .wfp-cards {
    grid-template-columns: 1fr;
  }

  .wfp-kpis {
    grid-template-columns: 1fr;
  }

  .wfp-quick-actions {
    grid-template-columns: 1fr;
  }

  .wfp-chat-msg {
    max-width: 90%;
  }

  .wfp-auth-card {
    padding: 28px 20px;
  }

  .wfp-ticket-header h1 {
    white-space: normal;
  }

  .wfp-invoice-amount {
    font-size: 20px;
  }
}

/* Tablet: kompaktere Tabs (nur Icons, kein Label) */
@media (max-width: 900px) and (min-width: 769px) {
  .wfp-nav-tab {
    padding: 8px 10px;
    gap: 0;
  }

  .wfp-nav-tab .wfp-nav-label {
    display: none;
  }
}

@media (max-width: 768px) {
  .wfp-user-name {
    display: none;
  }

  .wfp-shell-content {
    padding: 20px 16px 32px;
  }
}


/* =========================================
   13. BADGES (Unread)
   ========================================= */
.wfp-badge-unread {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--wfp-danger);
  border-radius: 10px;
  line-height: 1;
  margin-left: 6px;
  flex-shrink: 0;
}

.wfp-bottom-tab {
  position: relative;
}

.wfp-bottom-tab .wfp-badge-unread {
  position: absolute;
  top: 2px;
  right: 2px;
  margin-left: 0;
  min-width: 18px;
  height: 18px;
  font-size: 10px;
  padding: 0 5px;
}

.wfp-badge-new {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--wfp-danger);
  border-radius: 6px;
  padding: 3px 8px;
  line-height: 1;
  letter-spacing: .3px;
}


/* =========================================
   14. ANNOUNCEMENTS
   ========================================= */
.wfp-announcements {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.wfp-announcement {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--wfp-radius-sm);
  border-left: 4px solid;
  background: var(--wfp-card-bg);
  animation: wfpFadeIn .3s ease both;
}

.wfp-announcement--info {
  border-left-color: var(--wfp-accent);
  background: rgba(59,130,246,.06);
}

.wfp-announcement--warning {
  border-left-color: var(--wfp-warning);
  background: rgba(245,158,11,.06);
}

.wfp-announcement--success {
  border-left-color: var(--wfp-success);
  background: rgba(16,185,129,.06);
}

.wfp-announcement-icon {
  font-size: 18px;
  line-height: 1.4;
  flex-shrink: 0;
}

.wfp-announcement-body {
  flex: 1;
  min-width: 0;
}

.wfp-announcement-body strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--wfp-text);
  margin-bottom: 2px;
}

.wfp-announcement-body p {
  margin: 0;
  font-size: 13px;
  color: var(--wfp-muted);
  line-height: 1.5;
}

.wfp-announcement-dismiss {
  background: none;
  border: none;
  color: var(--wfp-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  opacity: .6;
  transition: opacity var(--wfp-transition), color var(--wfp-transition);
  flex-shrink: 0;
}

.wfp-announcement-dismiss:hover {
  opacity: 1;
  color: var(--wfp-text);
}


/* =========================================
   15. TICKET SEARCH/FILTER
   ========================================= */
.wfp-searchbar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.wfp-search-input {
  flex: 1;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--wfp-text);
  background: var(--wfp-card-bg);
  border: 1px solid var(--wfp-card-border);
  border-radius: var(--wfp-radius-sm);
  transition: border-color var(--wfp-transition), box-shadow var(--wfp-transition);
}

.wfp-search-input::placeholder {
  color: var(--wfp-muted);
  opacity: .6;
}

.wfp-search-input:focus {
  outline: none;
  border-color: var(--wfp-accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

.wfp-search-select {
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--wfp-text);
  background: var(--wfp-card-bg);
  border: 1px solid var(--wfp-card-border);
  border-radius: var(--wfp-radius-sm);
  cursor: pointer;
  min-width: min(140px, 100%);
}

.wfp-search-select:focus {
  outline: none;
  border-color: var(--wfp-accent);
}

.wfp-no-results {
  text-align: center;
  padding: 40px 20px;
  color: var(--wfp-muted);
  font-size: 15px;
}

@media (max-width: 520px) {
  .wfp-searchbar {
    flex-direction: column;
  }

  .wfp-search-select {
    min-width: auto;
  }
}


/* =========================================
   16. DEVICE CARDS
   ========================================= */
.wfp-device-card {
  background: var(--wfp-card-bg);
  border: 1px solid var(--wfp-card-border);
  border-radius: var(--wfp-radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color var(--wfp-transition), transform var(--wfp-transition);
}

.wfp-device-card:hover {
  border-color: rgba(148,163,184,.35);
  transform: translateY(-2px);
}

.wfp-device-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.wfp-device-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--wfp-accent);
}

.wfp-device-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--wfp-text);
  margin: 0;
  line-height: 1.3;
}

.wfp-device-type {
  font-size: 13px;
  color: var(--wfp-muted);
}

.wfp-device-detail {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--wfp-muted);
}

.wfp-device-label {
  font-weight: 600;
  color: var(--wfp-text);
  opacity: .7;
}

.wfp-device-service svg {
  width: 14px;
  height: 14px;
  margin-right: 2px;
}

.wfp-device-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}

.wfp-device-status--aktiv {
  background: rgba(16,185,129,.12);
  color: #16a34a;
  border: 1px solid rgba(16,185,129,.25);
}

.wfp-device-status--wartung {
  background: rgba(245,158,11,.12);
  color: #d97706;
  border: 1px solid rgba(245,158,11,.25);
}

.wfp-device-status--problem {
  background: rgba(239,68,68,.12);
  color: #dc2626;
  border: 1px solid rgba(239,68,68,.25);
}

.wfp-device-status--deaktiviert {
  background: rgba(148,163,184,.1);
  color: var(--wfp-muted);
  border: 1px solid rgba(148,163,184,.2);
}


/* =========================================
   17. TERMIN SUCCESS
   ========================================= */
.wfp-termin-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 60px 20px;
}

.wfp-termin-success h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--wfp-text);
  margin: 16px 0 8px;
}

.wfp-termin-success p {
  font-size: 15px;
  color: var(--wfp-muted);
  max-width: 400px;
  margin: 0;
}


/* =========================================
   18. PASSWORD STRENGTH METER
   ========================================= */
.wfp-pw-strength {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  margin-bottom: 12px;
}

.wfp-pw-strength-bar {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--wfp-line);
  overflow: hidden;
  position: relative;
}

.wfp-pw-strength-bar::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0;
  border-radius: 3px;
  transition: width .3s ease, background .3s ease;
}

.wfp-pw-strength[data-level="weak"] .wfp-pw-strength-bar::after {
  width: 33%;
  background: var(--wfp-danger);
}

.wfp-pw-strength[data-level="medium"] .wfp-pw-strength-bar::after {
  width: 66%;
  background: var(--wfp-warning);
}

.wfp-pw-strength[data-level="strong"] .wfp-pw-strength-bar::after {
  width: 100%;
  background: var(--wfp-success);
}

.wfp-pw-strength-text {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.wfp-pw-strength[data-level="weak"] .wfp-pw-strength-text { color: var(--wfp-danger); }
.wfp-pw-strength[data-level="medium"] .wfp-pw-strength-text { color: var(--wfp-warning); }
.wfp-pw-strength[data-level="strong"] .wfp-pw-strength-text { color: var(--wfp-success); }


/* =========================================
   19. PRIORITY BADGES
   ========================================= */
.wfp-priority {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

.wfp-priority--niedrig {
  background: rgba(16,185,129,.12);
  color: #10b981;
  border: 1px solid rgba(16,185,129,.25);
}

.wfp-priority--normal {
  background: rgba(59,130,246,.12);
  color: #3b82f6;
  border: 1px solid rgba(59,130,246,.25);
}

.wfp-priority--hoch {
  background: rgba(245,158,11,.12);
  color: #d97706;
  border: 1px solid rgba(245,158,11,.25);
}

.wfp-priority--dringend {
  background: rgba(239,68,68,.12);
  color: #dc2626;
  border: 1px solid rgba(239,68,68,.25);
}


/* =========================================
   13. ATTACHMENTS + UPLOAD BUTTON
   ========================================= */

/* Image attachment in chat bubble */
.wfp-attachment-img {
  display: block;
  margin-top: 8px;
  border-radius: var(--wfp-radius-xs);
  overflow: hidden;
  max-width: 300px;
}

.wfp-attachment-img img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--wfp-radius-xs);
  transition: opacity var(--wfp-transition);
}

.wfp-attachment-img:hover img {
  opacity: .85;
}

/* File attachment link in chat bubble */
.wfp-attachment-file {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 8px 14px;
  background: rgba(59,130,246,.08);
  border: 1px solid rgba(59,130,246,.2);
  border-radius: var(--wfp-radius-xs);
  color: var(--wfp-accent);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background var(--wfp-transition);
}

.wfp-attachment-file:hover {
  background: rgba(59,130,246,.15);
}

.wfp-attachment-file svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Upload / paperclip button in chat form */
.wfp-chat-upload {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: var(--wfp-radius-sm);
  color: var(--wfp-muted);
  cursor: pointer;
  transition: color var(--wfp-transition), background var(--wfp-transition);
}

.wfp-chat-upload:hover {
  color: var(--wfp-accent);
  background: rgba(59,130,246,.08);
}

.wfp-chat-upload svg {
  width: 20px;
  height: 20px;
}

/* File preview bar below chat form */
.wfp-file-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin-top: 6px;
  background: rgba(59,130,246,.06);
  border: 1px solid rgba(59,130,246,.15);
  border-radius: var(--wfp-radius-xs);
  font-size: 13px;
  color: var(--wfp-text);
}

.wfp-file-preview[hidden] { display: none; }

.wfp-file-preview-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wfp-file-preview-remove {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--wfp-muted);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.wfp-file-preview-remove:hover {
  color: var(--wfp-danger);
}
