/* =========================
   RESET / BASE
========================= */

html, body { margin: 0; padding: 0; width: 100%; }
*, *::before, *::after { box-sizing: border-box; }

:root {
  --p-blue: #004a99;
  --a-cyan: #00d2ff;
  --sidebar-w: 250px;
  --header-h: 60px;
  --crm-bg: #f1f4f9;
  --crm-border: #e5e7eb;
  --crm-text: #0f172a;
  --crm-muted: #64748b;
  --crm-primary: #2563eb;
  --crm-success: #10b981;
  --crm-warning: #f59e0b;
  --crm-danger:  #ef4444;
  --crm-shadow: 0 8px 18px rgba(0,0,0,.08);
  --crm-radius: 12px;
}

/* FONTS LOKAL */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('/assets/fonts/inter/inter-v20-latin-300.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/inter/inter-v20-latin-regular.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/inter/inter-v20-latin-600.woff2') format('woff2');
}

/* GLOBAL BODY */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--crm-bg);
  color: var(--crm-text);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}  
	
/* =========================
   TOP NAVBAR
========================= */
.top-navbar{
  height: var(--header-h);
  background: var(--p-blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 25px;
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 2000;
  box-shadow: 0 2px 10px rgba(0,0,0,.10);
}
.header-right{ display:flex; align-items:center; gap:20px; }
.header-clock{
  text-align:right;
  line-height:1.2;
  font-size:11px;
  border-left:1px solid rgba(255,255,255,.30);
  padding-left:15px;
  color:#fff;
}

/* Header Messenger Badge */
.hdr-msg{ position:relative; }
.hdr-msg__btn{
  position:relative;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:42px;
  height:42px;
  border-radius:12px;
  color:#fff;
  text-decoration:none;
}
.hdr-msg__btn i{ font-size:18px; }
.hdr-msg__badge{
  position:absolute;
  top:-6px;
  right:-6px;
  min-width:18px;
  height:18px;
  padding:0 5px;
  border-radius:999px;
  background: var(--crm-danger);
  color:#fff;
  font-size:11px;
  font-weight:900;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:2px solid var(--p-blue);
  line-height:1;
}

/* Notifications */
.notif-btn{ position:relative; cursor:pointer; padding:5px; font-size:18px; }
.n-badge{
  position:absolute; top:-2px; right:-2px;
  background: var(--crm-danger);
  color:#fff; border-radius:10px;
  padding:1px 5px; font-size:10px;
  display:none; border:1px solid var(--p-blue);
}
/* Dropdown Basis */
.n-dropdown{
  position:absolute;
  right:0;
  top:58px;

  width:320px;
  background:#fff;
  border-radius:10px;
  box-shadow:0 10px 30px rgba(0,0,0,.20);
  color:#333;
  z-index:3000;
  overflow:hidden;
  border:1px solid #ddd;

  /* Animation Startzustand */
  opacity:0;
  transform:translateY(-8px);
  pointer-events:none;
  transition:
    opacity .18s ease,
    transform .18s ease;
}

/* Geöffnet */
.n-dropdown.is-open{
  opacity:1;
  transform:translateY(0);
  pointer-events:auto;
}
.n-header{
  padding:12px;
  font-weight:800;
  border-bottom:1px solid #eee;
  background:#f8f9fa;
  display:flex;
  justify-content:space-between;
  font-size:13px;
}
.notif-wrapper{ position:relative; border-bottom:0px solid #eee; }
.notif-link{
  display:block;
  padding:12px 40px 12px 12px;
  text-decoration:none;
  color:#333;
  font-size:12px;
}
.notif-delete{
  position:absolute; right:10px; top:12px;
  color:#cbd5e1; cursor:pointer; font-size:14px; z-index:10;
}
.notif-delete:hover{ color: var(--crm-danger); }
	

/* Responsive Header-Fix */
@media (max-width: 768px) {
    /* 1. Uhrzeit auf dem Handy ausblenden (nimmt zu viel Platz weg) */
    .header-clock {
        display: none !important;
    }

    /* 2. Den Benutzernamen kürzen oder nur das Icon zeigen */
    .header-right a span {
        display: none; /* Versteckt den Text "Admin" etc., zeigt nur das Icon */
    }

    /* 3. Abstände verringern */
    .header-right {
        gap: 12px !important;
        padding-right: 10px !important;
    }

    /* 4. Logo-Bereich schmaler machen, damit mehr Platz für Icons bleibt */
    header div[style*="width: 250px"] {
        width: 180px !important; 
        min-width: 180px !important;
    }
}

/* Speziell für das iPad (Portrait Modus) */
@media (min-width: 769px) and (max-width: 1024px) {
    .header-clock {
        font-size: 12px;
    }
    .header-right {
        gap: 15px !important;
    }
}

/* =========================
   SIDEBAR
========================= */
.sidebar-new{
  width: var(--sidebar-w);
  background:#fff;
  border-right:1px solid #e2e8f0;
  position:fixed;
  top: var(--header-h);
  left:0;
  bottom:0;
  z-index:999;
  overflow-y:auto;
  padding:10px 0;
}
.sidebar-label{
  padding:20px 25px 8px;
  font-size:10px;
  font-weight:900;
  color:#94a3b8;
  text-transform:uppercase;
  letter-spacing:1px;
}
.sidebar-link{
  display:flex;
  align-items:center;
  padding:11px 25px;
  color:#334155;
  text-decoration:none;
  font-size:14px;
  transition: background .15s ease, color .15s ease;
  border-left:4px solid transparent;
}
.sidebar-link i{
  width:30px;
  font-size:16px;
  color:#64748b;
  transition: color .15s ease;
}
.sidebar-link:hover{ background:#f1f5f9; color: var(--p-blue); }
.sidebar-link:hover i{ color: var(--p-blue); }
.sidebar-link.active{
  background:#eef2ff;
  color: var(--p-blue);
  border-left-color: var(--p-blue);
  font-weight:800;
}
.sidebar-link.active i{ color: var(--p-blue); }

/* =========================
   LAYOUT
========================= */
.main-content{
  margin-left: var(--sidebar-w);
  margin-top: var(--header-h);
  min-height: calc(100vh - var(--header-h));
  padding: 40px 30px;
}
.content-inner{
  width:100%;
  max-width:1100px;
  margin:0 auto;
}

/* =========================
   HEADINGS / FLASH / PAGE HEAD
========================= */
.page-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  margin-bottom:18px;
}
.page-head h2{ margin:0; font-size:26px; font-weight:900; }
.page-head p{ margin:6px 0 0; color: var(--crm-muted); font-size:14px; }

.title-inline{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
}

.flash-msg{
  background:#fff;
  border:1px solid var(--crm-border);
  border-left:4px solid var(--crm-primary);
  border-radius:14px;
  padding:12px 14px;
  margin:0 0 18px;
  box-shadow:0 4px 12px rgba(0,0,0,.04);
}

.alert{
  background:#fff;
  border:1px solid var(--crm-border);
  border-radius:14px;
  padding:12px 14px;
  margin:0 0 18px;
  box-shadow:0 4px 12px rgba(0,0,0,.04);
  font-weight:800;
}
.alert.success{ border-left:4px solid var(--crm-success); }
.alert.danger{  border-left:4px solid var(--crm-danger);  }

/* =========================
   CARDS (einheitlich)
========================= */
.crm-card,
.applet{
  background:#fff;
  border:1px solid var(--crm-border);
  border-radius: var(--crm-radius);
  box-shadow: var(--crm-shadow);
  margin-bottom:18px;
}

/* Standard-Padding für Cards */
.crm-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05); /* Weicher Schatten statt Rahmen */
    border: none !important; /* Entfernt alle Linien */
    overflow: hidden;
}

/* Card Head */
.card-head{
  display:flex;
  align-items:center;
  gap:10px;
  padding:14px 18px;
  border-bottom:1px solid var(--crm-border);
  background:#f8fafc;
  font-weight:900;
  color:#0f172a;
}
.card-head i{ color: var(--p-blue); }

/* Standard body */
.card-body{ padding:18px; }

/* card-flush: KEIN Innenpadding, aber Card bleibt */
.crm-card.card-flush{
  padding:0;
  overflow:hidden;
}

/* Card ohne sichtbaren Rahmen (nur dort wo du es willst) */
.crm-card.card-no-border{
  border:0 !important;
}
.dashboard-card {
  background: #fff;
  border-radius: var(--crm-radius); /* 12px aus :root */
  box-shadow: 0 4px 12px rgba(0,0,0,.04); /* Dezentester Schatten */
  
  /* WICHTIG: Kein Rahmen mehr als Standard! */
  border: 0 !important;
  
  margin-bottom: 25px; /* Spacing zwischen den Zeilen */
  overflow: hidden; /* Für runde Ecken im Footer */
  transition: box-shadow 0.15s ease-in-out;
}
.crm-card:hover {
  box-shadow: 0 10px 18px rgba(0,0,0,.06);
}

/* --- Spezifische Panel-Anpassungen --- */

/* Kassenbuch Panel (style.css) */
.dashboard-card--cashbook .trend-row {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 24px 15px;
}

.dashboard-card--cashbook .divider {
    border-left: 1px solid #f1f5f9;
    height: 60px;
}

/* Rechnungs Panel (style.css) */
.dashboard-card--invoices .f-hint {
    color: var(--crm-muted);
    font-size: 11px;
    letter-spacing: normal;
    text-transform: none;
    margin-top: 4px;
}
/* =========================
   BUTTONS
========================= */
.btn-row{ display:flex; gap:10px; flex-wrap:wrap; align-items:center; }

.btn,
.btn-primary,
.btn-success,
.btn-soft,
.btn-ghost{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  line-height:1;
  text-decoration:none !important;
}

.btn{
  padding:10px 16px;
  border-radius:999px;
  font-weight:800;
  border:1px solid transparent;
  cursor:pointer;
  transition:.15s ease;
}
.btn:active{ transform: translateY(1px); }

.btn-primary{
  background: var(--p-blue);
  color:#fff;
  border:1px solid rgba(0,74,153,.20);
  box-shadow:0 6px 16px rgba(0,74,153,.25);
  padding:10px 16px;
  border-radius:999px;
  font-weight:900;
}
.btn-primary:hover{ transform: translateY(-1px); box-shadow:0 8px 18px rgba(0,74,153,.35); }

.btn-success{
  background: var(--crm-success);
  color:#fff;
  border:1px solid rgba(16,185,129,.35);
  box-shadow:0 10px 20px rgba(16,185,129,.16);
  padding:10px 16px;
  border-radius:999px;
  font-weight:900;
}
.btn-success:hover{ filter: brightness(1.03); transform: translateY(-1px); }

.btn-soft{
  background:#f1f5f9;
  border:1px solid #e2e8f0;
  color:#475569;
  box-shadow:0 4px 12px rgba(0,0,0,.04);
  padding:10px 16px;
  border-radius:999px;
  font-weight:900;
}
.btn-soft:hover{ filter: brightness(.99); }

.btn-ghost{
  width:44px;
  height:44px;
  padding:0 !important;
  border-radius:14px;
  background:#fff;
  border:1px solid var(--crm-border);
  color: var(--crm-text);
  box-shadow:0 4px 12px rgba(0,0,0,.04);
}
.btn-ghost:hover{ background:#f8fafc; }

.btn-icon{
  width:42px;
  height:42px;
  padding:0 !important;
  border-radius:14px;
  border:1px solid #e2e8f0;
  background:#fff;
  color:#64748b;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.btn-icon:hover{ background:#f8fafc; }

.btn-full{ width:100%; }

/* =========================
   PILLS / BADGES
========================= */
.pill{
  display:inline-flex;
  align-items:center;
  padding:6px 12px;
  border-radius:999px;
  font-size:12px;
  font-weight:900;
  letter-spacing:.4px;
  background:#eef2ff;
  color:#1d4ed8;
  border:1px solid rgba(29,78,216,.18);
  white-space:nowrap;
}

.badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:6px 12px;
  border-radius:999px;
  font-size:12px;
  font-weight:800;
  letter-spacing:.04em;
  text-transform:uppercase;
  border:1px solid transparent;
}
.badge-active   { background:#dcfce7; color:#166534; border-color:#bbf7d0; }
.badge-inactive { background:#f1f5f9; color:#475569; border-color:#e2e8f0; }
.badge-archived { background:#fef9c3; color:#92400e; border-color:#fde68a; }

/* =========================
   TOOLBARS – BASE
========================= */
.crm-toolbar{
  display:flex;
  gap:12px;
  align-items:center;
  margin:0 0 18px;
}

/* Generic select */
.select,
.crm-toolbar select{
  min-width:190px;
  background:#fff;
  border:1px solid var(--crm-border);
  border-radius:14px;
  padding:12px 14px;
  font-size:14px;
  cursor:pointer;
}

.loader{
  display:none;
  align-items:center;
  gap:10px;
  color: var(--crm-muted);
  font-weight:800;
  font-size:13px;
  padding:10px 12px;
  border:1px solid var(--crm-border);
  border-radius:12px;
  background:#fff;
  white-space:nowrap;
}
.loader.show{ display:flex; }

/* =========================
   COMPANIES TOOLBAR (admin_companies.php)
   Benutze: <div class="crm-toolbar crm-toolbar--companies">
            <div class="crm-search">...</div>
            <select class="crm-select">...</select>
            <div id="loader" class="loader">...</div>
            </div>
========================= */
.crm-toolbar--companies{
  display:grid;
  grid-template-columns: 1fr 260px auto;
  gap:14px;
  align-items:center;
  margin: 0 0 18px;
}

.crm-search{ position:relative; min-width:0; }
.crm-search i{
  position:absolute;
  left:16px;
  top:50%;
  transform:translateY(-50%);
  color:#94a3b8;
  font-size:14px;
  pointer-events:none;
}
.crm-search input{
  width:100%;
  height:48px;
  padding:0 16px 0 42px;
  border:1px solid var(--crm-border);
  border-radius:14px;
  background:#fff;
  font-size:14px;
  transition:.15s ease;
}
.crm-search input:focus{
  border-color: rgba(37,99,235,.6);
  box-shadow:0 0 0 4px rgba(37,99,235,.12);
}
.crm-select{
  height:48px;
  width:260px;
  max-width:260px;
  padding:0 16px;
  border:1px solid var(--crm-border);
  border-radius:14px;
  background:#fff;
  font-size:14px;
  cursor:pointer;
  transition:.15s ease;
}
.crm-select:focus{
  border-color: rgba(37,99,235,.6);
  box-shadow:0 0 0 4px rgba(37,99,235,.12);
}

/* =========================
   TABLES
========================= */
.table-wrap{
  border:1px solid var(--crm-border);
  border-radius:14px;
  overflow:hidden;
  overflow-x:auto;
  background:#fff;
}

/* table-wrap ohne inneren Rahmen */
.table-wrap--plain{
  border:0 !important;
  border-radius:0 !important;
  background:transparent !important;
}

.crm-table{
  width:100%;
  border-collapse:collapse;
  font-variant-numeric: tabular-nums;
}
.crm-table thead th{
  text-align:left;
  font-size:12px;
  letter-spacing:.04em;
  text-transform:uppercase;
  color: var(--crm-muted);
  padding:14px 18px;
  border-bottom:1px solid var(--crm-border);
  background:#fbfcfe;
}
.crm-table tbody td{
  padding:16px 18px;
  border-bottom:1px solid #eef2f7;
  vertical-align:middle;
  font-size:14px;
}
.crm-table tbody tr:hover{ background:#f8fafc; }

/* =========================
   FORMS
========================= */
.form-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:14px;
}

.f-label{
  display:block;
  font-size:11px;
  font-weight:900;
  color:#64748b;
  text-transform:uppercase;
  letter-spacing:.04em;
  margin-bottom:6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="file"],
input[type="date"],
select,
textarea{
  width:100%;
  padding:10px 12px;
  border:1px solid var(--crm-border);
  border-radius:12px;
  font-size:14px;
  background:#fff;
  transition:border-color .15s, box-shadow .15s;
}

input:focus, select:focus, textarea:focus{
  border-color: rgba(37,99,235,.6);
  box-shadow: 0 0 0 4px rgba(37,99,235,.12);
}

input[readonly], input:disabled, select:disabled, textarea:disabled{
  background:#f8fafc !important;
  color:#64748b !important;
}

.f-hint{
  margin-top:6px;
  font-size:12px;
  color:#94a3b8;
  font-weight:800;
}

.divider{
  height:1px;
  background:#eef2f7;
  margin:22px 0;
}

.actions,
.form-actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top:18px;
  padding-top:14px;
  border-top:1px solid #eef2f7;
}

/* =========================
   manage_users – scoped fix (keine globalen Zerstörungen!)
========================= */
.crm-card.crm-card--form.crm-card--fill
  /* Box bleibt normal wie jede Card */

.crm-card.crm-card--form.crm-card--fill.card-no-border{
  border:0 !important;
}

/* Inputs nicht kleben */
.crm-card--form .form-row{ margin-bottom:14px; }
.crm-card--form .f-row-2{ display:grid; grid-template-columns: 1fr 1fr; gap:12px; }
@media (max-width: 900px){
  .crm-card--form .f-row-2{ grid-template-columns: 1fr; }
}

/* =========================
   CUSTOMER / ADMIN COMPANY VIEW – SPLIT + KV
========================= */
.split-grid{
  display:grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap:18px;
  align-items:start;
}

.kv{
  padding:16px 18px 18px;
  display:flex;
  flex-direction:column;
  gap:14px;
}
.kv-item{
  display:flex;
  flex-direction:column;
  gap:6px;
  padding-bottom:14px;
  border-bottom:1px solid #eef2f7;
}
.kv-item:last-child{ border-bottom:0; padding-bottom:0; }
.kv-label{
  font-size:11px;
  font-weight:900;
  color:#64748b;
  text-transform:uppercase;
  letter-spacing:.06em;
}
.kv-value{
  font-size:14px;
  font-weight:800;
  color: var(--crm-text);
  line-height:1.4;
}
.kv-link{
  font-size:14px;
  font-weight:900;
  color: var(--p-blue);
  text-decoration:none;
}
.kv-link:hover{ text-decoration:underline; }

.crm-softbox{
  background:#fff;
  border:0;
  border-radius:0;
}

/* =========================
   TABS
========================= */
.tabs {
  display: flex;
  gap: 8px; /* Etwas schmaler für mehr Platz */
  flex-wrap: nowrap; /* ERZWINGT eine Reihe */
  overflow-x: auto;  /* Erlaubt horizontales Scrollen auf dem Handy, statt Umbruch */
  padding: 12px 16px;
  border-bottom: 1px solid var(--crm-border);
  background: #fbfcfe;
  -webkit-overflow-scrolling: touch; /* Sanftes Scrollen auf iOS */
}

/* Versteckt die Scrollbar für einen sauberen Look (optional) */
.tabs::-webkit-scrollbar {
  display: none;
}

.tab-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px; /* Etwas kompakteres Padding */
  border-radius: 999px;
  border: 1px solid var(--crm-border);
  background: #fff;
  color: #475569;
  font-weight: 800; /* Etwas weniger fett für bessere Lesbarkeit in der Reihe */
  text-decoration: none;
  transition: .15s ease;
  white-space: nowrap; /* Verhindert Zeilenumbruch im Text des Tabs */
  font-size: 13px;    /* Optimale Größe für viele Tabs */
}

.tab-link i {
  font-size: 14px;
  color: #94a3b8;
}

.tab-link:hover {
  background: #f8fafc;
  color: var(--p-blue);
  border-color: rgba(0,74,153,.25);
}

.tab-link.active {
  background: #e8eff7;
  border-color: rgba(0,74,153,.35);
  color: var(--p-blue);
}

.tab-link.active i {
  color: var(--p-blue);
}

.tab-body{
  padding:18px;
  background:transparent;
  border:0;
}

/* =========================
   DASHBOARD
========================= */
.dashboard-head{ margin-bottom:18px; }
.dashboard-head h2{ margin:0; font-size:28px; font-weight:900; }
.dashboard-head p{ margin:6px 0 0; color: var(--crm-muted); font-weight:700; }

.kpi-grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:16px;
  margin-bottom:16px;
}
.kpi-card{
  background:#fff;
  border:1px solid var(--crm-border);
  border-radius:16px;
  box-shadow: var(--crm-shadow);
  padding:18px;
  position:relative;
  overflow:hidden;
}
.kpi-card::before{
  content:"";
  position:absolute;
  left:0; top:0; bottom:0;
  width:5px;
  background: var(--crm-primary);
}
.kpi-blue::before{ background:#3b82f6; }
.kpi-amber::before{ background:#f59e0b; }
.kpi-green::before{ background:#10b981; }

.kpi-label{
  font-size:11px;
  color: var(--crm-muted);
  text-transform:uppercase;
  font-weight:900;
  letter-spacing:.06em;
}
.kpi-value{
  font-size:26px;
  font-weight:900;
  color: var(--crm-text);
  margin-top:8px;
  font-variant-numeric: tabular-nums;
}

.dashboard-grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:16px;
  align-items:start;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 1100px){
  .split-grid{ grid-template-columns: 1fr; }
  .kpi-grid{ grid-template-columns: 1fr; }
  .dashboard-grid{ grid-template-columns: 1fr; }
}
@media (max-width: 900px){
  .main-content{ margin-left:0; padding:20px; }
  .content-inner{ max-width:100%; }
  .form-grid{ grid-template-columns: 1fr; }
}
@media (max-width: 720px){
  .crm-toolbar--companies{
    grid-template-columns: 1fr;
  }
  .crm-select{ width:100%; max-width:none; }
  .btn-row{ width:100%; }
  .btn-primary, .btn-success, .btn-soft{ width:100%; }
}
/* =========================================
   admin_companies.php – Toolbar fix (scoped)
   - Lupe sitzt korrekt im Feld
   - Input/Select gleiche Höhe
   - Kein "komischer" Rahmen / keine kaputten Abstände
========================================= */

.crm-toolbar.crm-toolbar--companies{
  display: grid;
  grid-template-columns: 1fr 260px auto;
  gap: 14px;
  align-items: center;
  margin: 0 0 18px;
}

/* Search box */
.crm-toolbar--companies .search.search--companies{
  position: relative;
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 14px 0 44px;              /* Platz für Icon */
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--crm-border);
  box-shadow: 0 6px 14px rgba(15,23,42,.04);
}

/* Icon fix (nicht "schwebend") */
.crm-toolbar--companies .search.search--companies > i{
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 14px;
  pointer-events: none;
}

/* Input clean */
.crm-toolbar--companies .search.search--companies input{
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 0;
  font-size: 14px;
  height: 100%;
}

/* Focus */
.crm-toolbar--companies .search.search--companies:focus-within{
  border-color: rgba(37,99,235,.6);
  box-shadow: 0 0 0 4px rgba(37,99,235,.12), 0 10px 18px rgba(15,23,42,.06);
}

/* Select gleiche Höhe wie Suche */
.crm-toolbar--companies .select.select--companies{
  height: 48px;
  width: 260px;
  max-width: 260px;
  padding: 0 14px;
  border-radius: 14px;
}

/* Loader optisch passend */
.crm-toolbar--companies .loader{
  height: 48px;
  display: none;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--crm-border);
  background: #fff;
  color: var(--crm-muted);
  font-weight: 800;
  white-space: nowrap;
}
.crm-toolbar--companies .loader.show{ display:flex; }

/* Mobile */
@media (max-width: 720px){
  .crm-toolbar.crm-toolbar--companies{
    grid-template-columns: 1fr;
  }
  .crm-toolbar--companies .select.select--companies{
    width: 100%;
    max-width: none;
  }
}

/* =========================================
   card-no-border: Box bleibt, Border weg
   (ohne andere Cards zu zerstören)
========================================= */
.crm-card.card-no-border{
  border: 0;
  /* Box bleibt weiß + Shadow bleibt aus .crm-card */
}

/* =========================================
   Tabelle ohne inneren Rahmen ist bei dir schon korrekt:
   .table-wrap.table-wrap--plain
========================================= */
/* =========================================================
   admin_company_add.php – Layout & Form Spacing Fix
   Klassen: .grid-3, .form-stack, .card-accent, .form-footer
   ========================================================= */

/* 3-Spalten-Grid (Unternehmensdaten / Kontakt & System / Mandanten-Zugang) */
.grid-3{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

/* Form Stack: sorgt dafür, dass Felder NICHT aneinander kleben */
.form-stack{
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Wenn in form-stack eine form-grid steckt: kein doppelt großes Gap */
.form-stack .form-grid{
  gap: 14px;
}

/* Akzent-Card für Mandanten-Zugang (optional, aber schön) */
.crm-card.card-accent{
  position: relative;
  overflow: hidden;
}
.crm-card.card-accent::before{
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: rgba(0,74,153,.85); /* Brand-Leiste */
}

/* Card Head in accent card bleibt bündig */
.crm-card.card-accent .card-head{
  position: relative;
  z-index: 1;
}
.crm-card.card-accent .form-stack{
  position: relative;
  z-index: 1;
}

/* Footer unter dem Grid */
.form-footer{
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #eef2f7;
}

/* Footer Button optisch konsistent */
.form-footer .btn-success{
  height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  font-weight: 900;
}

/* Responsive */
@media (max-width: 1100px){
  .grid-3{
    grid-template-columns: 1fr;
  }
}
@media (max-width: 720px){
  .form-footer{
    justify-content: stretch;
  }
  .form-footer .btn-success{
    width: 100%;
  }
}
/* =========================
   DASHBOARD – stabile Cards (scoped!)
========================= */

/* Dashboard Cards: wie Panels, ohne doppelte Innenoptik */
.crm-card.dashboard-card{
  padding: 0;                 /* card-head/body steuern das Padding */
  overflow: hidden;
}

/* Head sauber bündig */
.crm-card.dashboard-card .card-head{
  padding: 16px 18px;
  margin: 0;
  border-bottom: 1px solid var(--crm-border);
  background: #fbfcfe;
}

/* Body padding einheitlich */
.crm-card.dashboard-card .card-body{
  padding: 16px 18px;
}

/* Dashboard Liste clean */
.dash-list{
  list-style: none;
  margin: 0;
  padding: 0;
}

.dash-list li{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #eef2f7;
  font-size: 13px;
}

.dash-list li:last-child{
  border-bottom: 0;
}

.dash-empty{
  justify-content: center !important;
  color: #94a3b8;
  font-weight: 800;
  padding: 14px 0 !important;
}

/* Link + Strong */
.dash-link{
  color: var(--p-blue);
  text-decoration: none;
  font-weight: 900;
}
.dash-link:hover{ text-decoration: underline; }

.dash-strong{
  color: var(--crm-text);
  font-weight: 900;
  text-decoration: none;
}
.dash-strong:hover{
  color: var(--p-blue);
  text-decoration: underline;
}

.dash-sub{
  font-size: 11px;
  color: #94a3b8;
  font-weight: 800;
  margin-top: 4px;
}

.dash-amount{
  font-weight: 900;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Pills im Dashboard (fehlten) */
.pill-danger{
  background: rgba(239,68,68,.12);
  color: #b91c1c;
  border: 1px solid rgba(239,68,68,.18);
}

.pill-muted{
  background: rgba(148,163,184,.18);
  color: #475569;
  border: 1px solid rgba(148,163,184,.22);
}
/* Dropdown nur für Notifications öffnen */
.n-dropdown.is-open { display: block !important; }

/* Badge anzeigen, wenn >0 */
.n-badge.is-show { display: inline-flex !important; }
.notif-wrapper { position: relative; }

.n-dropdown{
  z-index: 5000;
}
.notif-empty{
  padding: 14px;
  text-align:center;
  color:#94a3b8;
  font-size:12px;
  font-weight:800;
}
.notif-wrapper.is-unread{ background:#f0f4f8; }
.notif-delete{ background:transparent; border:0; }
/* Bell Icon – kein Unterstrich, kein Border */
.notif-btn,
.notif-btn a {
  text-decoration: none !important;
  border-bottom: 0 !important;
}

/* Falls ein :after Strich erzeugt wird */
.notif-btn::after,
.notif-btn a::after {
  display: none !important;
  content: none !important;
}
/* =========================================================
   ADMIN MODULES (admin_modules.php) – Tile Layout
   Scoped: nur .module-* und .system-status
   ========================================================= */

.system-status{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap:6px;
  padding:12px 14px;
  background: rgba(255,255,255,.70);
  border: 1px solid rgba(148,163,184,.25);
  border-radius: 14px;
  box-shadow: 0 6px 14px rgba(15,23,42,.04);
}

.system-status-label{
  font-size:11px;
  font-weight:900;
  color: var(--crm-muted);
  text-transform:uppercase;
  letter-spacing:.06em;
}

.system-status-ok{
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-weight:900;
  color:#0f172a;
}
.system-status-ok i{
  color: var(--crm-success);
}

/* Grid */
.module-grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:16px;
  align-items:stretch;
}

/* Card */
.module-card{
  background:#fff;
  border: 1px solid var(--crm-border);
  border-radius: 16px;
  box-shadow: var(--crm-shadow);
  padding:18px;
  display:flex;
  flex-direction:column;
  min-height: 220px;
}

.module-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:14px;
}

.module-icon{
  width:44px;
  height:44px;
  border-radius: 14px;
  background: #f1f5f9;
  border: 1px solid rgba(148,163,184,.25);
  display:flex;
  align-items:center;
  justify-content:center;
  color: var(--p-blue);
}
.module-icon i{
  font-size:18px;
}

/* Title + Desc */
.module-title{
  margin: 0 0 6px;
  font-size:18px;
  font-weight:900;
  color: var(--crm-text);
  letter-spacing:-.2px;
}

.module-desc{
  margin: 0;
  color: var(--crm-muted);
  font-weight:700;
  line-height:1.5;
  font-size:13px;
}

/* Actions */
.module-actions{
  margin-top:auto;
  display:flex;
  gap:10px;
  align-items:center;
}

/* Badge Mapping (damit dein PHP so bleiben kann) */
.badge-success{
  background: rgba(34,197,94,.14);
  color: #15803d;
  border-color: rgba(34,197,94,.25);
}
.badge-warning{
  background: rgba(245,158,11,.14);
  color: #b45309;
  border-color: rgba(245,158,11,.28);
}
.badge-muted{
  background: rgba(148,163,184,.18);
  color: #475569;
  border-color: rgba(148,163,184,.28);
}

/* Add Card */
.module-card.module-add{
  cursor:pointer;
  border-style:dashed;
  background: rgba(255,255,255,.55);
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  transition: .15s ease;
}
.module-card.module-add:hover{
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(15,23,42,.10);
  border-color: rgba(0,74,153,.25);
}

.module-add-icon{
  width:52px;
  height:52px;
  border-radius: 16px;
  background:#eef2ff;
  border: 1px solid rgba(0,74,153,.18);
  color: var(--p-blue);
  display:flex;
  align-items:center;
  justify-content:center;
  margin-bottom:12px;
}
.module-add-icon i{ font-size:18px; }

.module-add-title{
  font-weight:900;
  color: var(--crm-text);
  margin-bottom:4px;
}
.module-add-sub{
  font-size:12px;
  font-weight:800;
  color: var(--crm-muted);
}

/* Responsive */
@media (max-width: 1100px){
  .module-grid{ grid-template-columns: 1fr; }
  .system-status{ align-items:flex-start; }
}
/* =========================
   DOCS TAB (admin_company_view -> documents)
========================= */
.docs-wrap{ padding:22px; }

.docs-head{ margin-bottom:14px; }
.docs-head h3{ margin:0; font-size:18px; font-weight:900; }
.docs-sub{ margin:6px 0 0; color:var(--crm-muted); font-size:12px; font-weight:800; }

.docs-upload{
  border:1px dashed rgba(148,163,184,.55);
  background:#f8fafc;
  border-radius:14px;
  padding:14px;
  margin-bottom:16px;
}
.docs-upload__row{
  display:flex;
  gap:12px;
  align-items:center;
  flex-wrap:wrap;
}
.docs-file{
  flex:1 1 420px;
  display:flex;
  align-items:center;
  gap:12px;
  background:#fff;
  border:1px solid var(--crm-border);
  border-radius:12px;
  padding:10px 12px;
  min-height:46px;
}
.docs-file input[type="file"]{ display:none; }

.docs-file__btn{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border-radius:10px;
  background:#eef2ff;
  color:#1d4ed8;
  font-weight:900;
  border:1px solid rgba(29,78,216,.18);
  white-space:nowrap;
}
.docs-file__name{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  color:var(--crm-muted);
  font-weight:800;
}
.docs-upload__submit{
  min-height:46px;
  border-radius:12px;
  padding:0 16px;
}
.docs-hint{ margin-top:10px; font-size:12px; color:#94a3b8; font-weight:800; }

.docs-empty{ padding:14px 0; color:#94a3b8; font-weight:800; }

.docs-table{
  border:1px solid var(--crm-border);
  border-radius:14px;
  overflow:hidden;
  background:#fff;
}
.docs-row{
  display:grid;
  grid-template-columns: 1fr 170px 170px;
  gap:12px;
  align-items:center;
  padding:12px 14px;
  border-bottom:1px solid #eef2f7;
}
.docs-row:last-child{ border-bottom:0; }

.docs-row--head{
  background:#fbfcfe;
  font-size:12px;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.04em;
  color:var(--crm-muted);
}
.docs-actions-col{ text-align:right; }

.docs-filecell{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}
.docs-ico{
  width:36px; height:36px;
  border-radius:12px;
  background:#f1f5f9;
  border:1px solid #e2e8f0;
  display:flex;
  align-items:center;
  justify-content:center;
  color:#64748b;
  flex:0 0 auto;
}
.docs-meta{ min-width:0; }
.docs-name{
  font-weight:900;
  color:var(--crm-text);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.docs-subline{
  font-size:11px;
  color:#94a3b8;
  font-weight:800;
  margin-top:2px;
}
.docs-date{ font-weight:800; color:#475569; font-size:13px; white-space:nowrap; }

.docs-actions{
  display:flex;
  justify-content:flex-end;
  gap:8px;
}
.docs-actions .btn-icon{ width:40px; height:40px; border-radius:12px; }

@media (max-width: 900px){
  .docs-row{ grid-template-columns: 1fr; }
  .docs-actions{ justify-content:flex-start; }
  .docs-actions-col{ text-align:left; }
}
/* ===== DOCUMENT MODAL ===== */

.crm-modal{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 5000;
}

.crm-modal.is-open{
  display: flex;
}

.crm-modal__panel{
  width: 92%;
  max-width: 1200px;
  height: 90vh;
  background: #fff;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 60px rgba(0,0,0,.25);
}

.crm-modal__head{
  padding: 14px 20px;
  border-bottom: 1px solid var(--crm-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
}

.crm-modal__body{
  flex: 1;
  background: #fff;
  overflow: hidden;
}

#docModalFrame{
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.crm-modal__panel{
  animation: modalPop .18s ease;
}

@keyframes modalPop{
  from{
    transform: scale(.95);
    opacity: 0;
  }
  to{
    transform: scale(1);
    opacity: 1;
  }
}
.crm-modal__panel{
  width: min(1100px, calc(100% - 60px));
  height: min(80vh, 820px);
}
#docModalPrint{
  background: var(--p-blue);
  color:#fff;
}
.crm-modal__title{
  display:flex;
  align-items:center;
  font-size:15px;
}
.crm-modal__title i{
  margin-right: 10px;
  font-size: 18px;
  opacity: .9;
}
.crm-modal__title span{
  font-size:14px;
}

#docModalName{
  font-size:13px;
  opacity:.8;
}
/* Viewer Body clean */
.crm-modal__body{
  background: #0b1220;          /* dunkler Rahmen wie macOS */
  padding: 14px;
}

/* Innerer Viewer-Rahmen */
.crm-modal__viewer{
  height:100%;
  background:#111827;
  border-radius:14px;
  overflow:hidden;
  box-shadow:0 14px 40px rgba(0,0,0,.35);
}

.crm-modal__viewer iframe{
  width:100%;
  height:100%;
  border:0;
  background:#fff;
  display:block;
}

/* image sauber (contain statt riesig) */
.crm-modal__viewer img{
  width:100%;
  height:100%;
  object-fit:contain;
  background:#111827;
  display:block;
}
/* Modal Panel kleiner & heller */
.crm-modal__panel{
  width: min(980px, calc(100% - 60px)) !important;
  height: min(74vh, 760px) !important;
  border-radius: 18px !important;
}

/* Body: KEIN schwarzer Hintergrund */
.crm-modal__body{
  background:#f8fafc !important;
  padding:14px !important;
}

/* Viewer: hell, sauber, keine schwarze Fläche */
.crm-modal__viewer{
  height:100%;
  background:#fff !important;
  border:1px solid rgba(148,163,184,.25);
  border-radius:14px;
  overflow:hidden;
  box-shadow:0 10px 28px rgba(15,23,42,.12);
}

/* iframe/pdf */
.crm-modal__viewer iframe{
  width:100%;
  height:100%;
  border:0;
  display:block;
  background:#fff;
}

/* Bilder: contain, aber ohne dunklen Rand */
.crm-modal__viewer img{
  width:100%;
  height:100%;
  object-fit:contain;
  background:#fff !important;
  display:block;
}
.crm-modal__body { background:#fff; }
.crm-modal__frame{
  width:100%;
  height:100%;
  border:0;
  display:block;
  background:#fff;
}
.crm-modal__img{
  max-width:100%;
  max-height:100%;
  object-fit:contain;
  display:block;
  margin:auto;
  background:#fff;
}
.badge {
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.badge-success { background:#dcfce7; color:#166534; }
.badge-danger  { background:#fee2e2; color:#991b1b; }
.badge-warning { background:#fef9c3; color:#92400e; }
.badge-info    { background:#e0f2fe; color:#075985; }
.badge-muted   { background:#f1f5f9; color:#475569; }

.link-strong {
  color:#004a99;
  font-weight:600;
  text-decoration:none;
}
.pill-warning{
  background:#fff7ed;
  color:#9a3412;
  border:1px solid #fed7aa;
}
/* ============================= */
/* INVOICE CREATE LAYOUT FIX     */
/* ============================= */

.invoice-page-grid{
  display:grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap:24px;
  align-items:start;
}

@media (max-width:1100px){
  .invoice-page-grid{
    grid-template-columns: 1fr;
  }
}
.invoice-side-card{
  background:#fff;
  border:1px solid var(--crm-border);
  border-radius:16px;
  overflow:hidden;
}

.invoice-side-head{
  padding:16px 18px;
  font-weight:800;
  background:#f8fafc;
  border-bottom:1px solid var(--crm-border);
}

.invoice-side-body{
  padding:18px;
}
.invcreate-items th{
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.04em;
  color:#64748b;
}

.invcreate-items td{
  vertical-align:middle;
}

.invcreate-items .input{
  height:44px;
}
.tot-row{
  display:flex;
  justify-content:space-between;
  font-weight:600;
  margin-bottom:6px;
  color:#334155;
}

.tot-total{
  display:flex;
  justify-content:space-between;
  font-size:18px;
  font-weight:900;
  color:#0f172a;
}
.btn-full{
  width:100%;
}
/* ========== Invoice Create: UI Polish (scoped) ========== */

/* nicer pill button */
.btn-pill{
  border-radius: 999px !important;
  padding: 12px 18px !important;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.btn-ghost{
  background: rgba(255,255,255,.65);
  border: 1px solid var(--crm-border);
  box-shadow: 0 10px 30px rgba(2,8,23,.06);
  backdrop-filter: blur(6px);
}
.btn-ghost:hover{
  transform: translateY(-1px);
  box-shadow: 0 14px 38px rgba(2,8,23,.10);
}

/* Items table: "floating rows" */
.invcreate-items{
  border-collapse: separate !important;
  border-spacing: 0 10px !important; /* Abstand zwischen Rows */
}
.invcreate-items thead th{
  background: transparent !important;
  border: 0 !important;
  padding-bottom: 8px !important;
  color: #64748b;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.invcreate-items tbody tr.item-row{
  background: #fff;
  box-shadow: 0 10px 30px rgba(2,8,23,.06);
  border: 1px solid var(--crm-border);
  border-radius: 14px;
  overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
}
.invcreate-items tbody tr.item-row:hover{
  transform: translateY(-1px);
  box-shadow: 0 14px 38px rgba(2,8,23,.10);
}
.invcreate-items tbody tr.item-row td{
  border: 0 !important;
  padding: 12px !important;
}
.invcreate-items tbody tr.item-row td:first-child{
  border-top-left-radius: 14px;
  border-bottom-left-radius: 14px;
}
.invcreate-items tbody tr.item-row td:last-child{
  border-top-right-radius: 14px;
  border-bottom-right-radius: 14px;
}

/* Sticky summary/right card */
.invoice-side-card{
  position: sticky;
  top: 88px; /* falls header fixed ist -> ggf. 72-96 anpassen */
  align-self: start;
}

/* emphasize discount/credit */
.invoice-side-body .field input#discount,
.invoice-side-body .field input#credit{
  font-weight: 900;
}
.invoice-side-body .field:has(#discount) .f-label,
.invoice-side-body .field:has(#credit) .f-label{
  color: #0f172a;
}
#discountView, #creditView{
  font-weight: 900;
}

/* kleine optik: totals block */
.invoice-side-body .tot-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding: 8px 0;
  color:#334155;
}
.invoice-side-body .tot-total{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding: 12px 12px;
  border-radius: 14px;
  background: rgba(2,132,199,.08);
  border: 1px solid rgba(2,132,199,.18);
  font-weight: 900;
}
.invcreate-items [data-remove-row]{
  background: #fff;
}
.invcreate-items [data-remove-row] i{
  color: var(--crm-danger);
  opacity: .85;
}
.invcreate-items [data-remove-row]:hover i{
  opacity: 1;
}
/* ===== Invoice Back Button Fix ===== */
.btn-back{
  display: inline-flex !important;
  align-items: center;
  gap: 10px;
  padding: 12px 20px !important;
  border-radius: 999px !important;
  font-weight: 800;
}

.btn-back i{
  font-size: 14px;
}
/* ===========================
   INVOICE VIEW – CLEAN STYLES
   =========================== */

.inv-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:18px;
  flex-wrap:wrap;
  margin-bottom:18px;
}

.inv-title{
  margin:0;
  font-size:28px;
  font-weight:900;
  letter-spacing:-0.02em;
}

.inv-sub{
  margin-top:8px;
  display:flex;
  align-items:center;
  gap:10px;
  color:var(--crm-muted);
  font-weight:700;
}

.inv-sub__sep{ opacity:.55; }

.inv-actions-top{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}

/* Buttons in der Headbar: gleich hoch & sauber */
.inv-actions-top .btn{
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding:12px 16px;
  border-radius:999px;
  font-weight:800;
}

/* Layout Grid */
.invoice-page-grid{
  display:grid;
  grid-template-columns: minmax(0,1fr) 360px;
  gap:18px;
  align-items:start;
}

@media (max-width: 980px){
  .invoice-page-grid{
    grid-template-columns: 1fr;
  }
}

/* Paper Card */
.invoice-paper{
  background:#fff;
  border:1px solid var(--crm-border);
  border-radius:18px;
  box-shadow:0 14px 40px rgba(15,23,42,.06);
  overflow:hidden;
}

.invoice-paper-head{
  padding:18px;
  border-bottom:1px solid var(--crm-border);
  display:flex;
  justify-content:space-between;
  gap:18px;
  flex-wrap:wrap;
}

.invoice-kicker{
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.08em;
  color:#94a3b8;
  font-weight:900;
}

.invoice-recipient-name{
  font-size:18px;
  font-weight:900;
  margin-top:6px;
}

.invoice-recipient-addr{
  margin-top:10px;
  color:#334155;
  font-weight:700;
  line-height:1.35;
}

.invoice-status-pill{
  display:inline-flex;
  align-items:center;
  padding:6px 12px;
  border-radius:999px;
  font-size:12px;
  font-weight:900;
  letter-spacing:.06em;
}

.invoice-status-pill.is-open{
  background:#fff7ed;
  color:#9a3412;
  border:1px solid #fed7aa;
}

.invoice-status-pill.is-paid{
  background:#ecfdf5;
  color:#065f46;
  border:1px solid #a7f3d0;
}

.invoice-status-pill.is-credited {
  background-color: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

/* Tabelle: „SaaS clean“ */
.invoice-table thead th{
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.08em;
  color:#64748b;
  font-weight:900;
  background:#f8fafc;
  border-bottom:1px solid var(--crm-border);
}

.invoice-table tbody td{
  padding:16px 14px !important;
  border-bottom:1px solid #eef2f7;
  vertical-align:middle;
}

.invoice-table tbody tr:hover{
  background:#fbfdff;
}

/* Totals Box */
.invoice-totals{
  padding:18px;
  display:flex;
  justify-content:flex-end;
}

.invoice-totals-box{
  width:min(420px, 100%);
  background:#f8fafc;
  border:1px solid #e5e7eb;
  border-radius:16px;
  padding:14px;
}

.tot-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:8px 6px;
  font-weight:800;
  color:#334155;
}

.tot-row--neg{
  background:#fff1f2;
  border:1px solid #fecdd3;
  border-radius:12px;
  padding:10px 10px;
  margin-top:8px;
}

.tot-row--neg strong{
  color:#9f1239;
}

.tot-total{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-top:10px;
  padding-top:12px;
  border-top:1px dashed #cbd5e1;
  font-size:18px;
  font-weight:900;
}

.tot-due{
  margin-top:10px;
  font-size:12px;
  color:#475569;
  font-weight:800;
}

/* Side Card + Sticky */
.invoice-side--sticky{
  position:sticky;
  top:18px;
}

.invoice-side-card{
  background:#fff;
  border:1px solid var(--crm-border);
  border-radius:18px;
  box-shadow:0 14px 40px rgba(15,23,42,.06);
  overflow:hidden;
}

.invoice-side-head{
  padding:14px 16px;
  font-weight:900;
  border-bottom:1px solid var(--crm-border);
  background:#f8fafc;
}

.invoice-side-body{
  padding:14px 16px;
}

.invoice-side-body select{
  width:100%;
  padding:12px 14px;
  border-radius:12px;
  border:1px solid var(--crm-border);
  background:#fff;
  font-weight:800;
}

.btn-full{ width:100%; }

/* PDF Modal iframe clean */
#pdfModal .crm-modal__body{
  padding:0;
  height: calc(80vh - 62px);
}

#pdfModalFrame{
  width:100%;
  height:100%;
  border:0;
  display:block;
  background:#fff;
}
.team-limitbar{
  margin-top:10px;
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.team-limitbar__pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px 12px;
  border-radius:999px;
  font-weight:800;
  font-size:12px;
  border:1px solid var(--crm-border);
  background:#fff;
}

.team-limitbar__pill i{
  opacity:.85;
}

.team-limitbar__hint{
  color:var(--crm-muted);
  font-weight:700;
  font-size:12px;
}

/* optional, wenn du diese Klassen noch nicht hast */
.pill-warn{
  background:#fffbeb;
  border-color:#fde68a;
  color:#92400e;
}
/* =========================================
   USER DETAIL – Rechnungsbereich Clean
========================================= */

.ud-invoice-card {
  background:#fff;
  border: 0;
  box-shadow: none;
}

.ud-invoice-card .card-head {
  background: transparent;
  border: 0;
}

.ud-invoice-card .table-wrap {
  border: 0;
  padding: 0;
  background: transparent;
}

.ud-invoice-card .crm-table {
  border: 0;
}
/* =========================================
   USER DETAIL – nur inneren Rahmen entfernen
========================================= */

.ud-invoice-card .table-wrap{
  background:#fff;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
}

/* falls die Tabelle selbst nochmal einen Rahmen zeichnet */
.ud-invoice-card .crm-table{
  border: 0;
}

/* optional: wenn um die Tabelle ein “Kasten” kommt (manche Styles setzen das auf tbody/thead) */
.ud-invoice-card .crm-table thead tr{
  background: transparent;
}
/* =========================
   manage_users – LEFT CARD FIX (scoped)
========================= */

.add-user-card{
  padding: 0 !important;              /* wir steuern innen über card-head + form */
  overflow: hidden;
}

.add-user-card .card-head{
  padding: 16px 18px !important;
}

.add-user-card .crm-form{
  padding: 16px 18px 18px !important; /* hier dein “schmaleres” Padding */
}
.add-user-card .form-row:last-of-type{
  margin-bottom: 0 !important;
}

/* Vorname/Nachname nebeneinander + Gap */
.add-user-card .f-row-2{
  display:grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 12px !important;
}

@media (max-width: 900px){
  .add-user-card .f-row-2{ grid-template-columns: 1fr !important; }
}
.add-user-card .btn.btn-primary.btn-full{
  height: 52px;
  border-radius: 16px !important;     /* weniger pillig */
  justify-content: center;
}
.add-user-card .form-row{ margin-bottom: 14px !important; }
.add-user-card .form-row:last-child{ margin-bottom: 0 !important; }
.add-user-card .crm-form > .btn{
  margin-top: 18px !important;
}

  /* customers.php – scoped UI polish (keine globalen Overrides) */
  .customers-list-card{ overflow:hidden; }

  /* Toolbar padding inside flush card */
  .customers-list-card .customers-toolbar{
    padding:16px 18px;
    margin:0;
    border-bottom:1px solid var(--crm-border);
    background:#fff;
  }

  /* Search + filter look consistent */
  .customers-list-card .customers-toolbar input,
  .customers-list-card .customers-toolbar select{ height:48px; }

  /* Table-wrap in this card should not add an extra "frame" */
  .customers-list-card .customers-table-wrap{
    border:0;
    border-radius:0;
    background:transparent;
  }

  /* Mobile: toolbar stacks nicely */
  @media (max-width: 720px){
    .customers-list-card .customers-toolbar{ display:grid; grid-template-columns: 1fr; gap:12px; }
  }

  /* Header right alignment */
  .customers-head{
    align-items:center;
  }

  .customers-head .btn-row{
    margin-left:auto;
  }

  /* Toolbar icons sauber ausgerichtet */
  .customers-list-card .search,
  .customers-list-card .filter{
    position:relative;
    display:flex;
    align-items:center;
  }

  .customers-list-card .search i,
  .customers-list-card .filter i{
    position:absolute;
    left:14px;
    color:#94a3b8;
    font-size:14px;
    pointer-events:none;
  }

  .customers-list-card .search input{
    padding-left:40px;
  }

  .customers-list-card .filter select{
    padding-left:40px;
  }

  .customers-list-card .search-clear{
    position:absolute;
    right:12px;
    background:transparent;
    border:0;
    font-size:16px;
    color:#94a3b8;
    cursor:pointer;
    display:none;
  }
/* =========================
   TICKETS TAB – Inline "Neues Ticket" Widget (scoped)
========================= */
.card-head--split{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
}

.ticket-create{ position:relative; }
.ticket-create > summary{ list-style:none; cursor:pointer; }
.ticket-create > summary::-webkit-details-marker{ display:none; }

.ticket-create[open] > summary{ filter: brightness(.98); }

.ticket-create__panel{
  margin-top:12px;
  border:1px solid var(--crm-border);
  border-radius:14px;
  overflow:hidden;
  background:#fff;
  box-shadow: 0 10px 24px rgba(15,23,42,.08);
}

.ticket-create__frame{
  width:100%;
  height:560px;
  border:0;
  display:block;
  background:#fff;
}

@media (max-width: 900px){
  .card-head--split{ flex-wrap:wrap; }
  .ticket-create{ width:100%; }
  .ticket-create > summary{ width:100%; justify-content:center; }
  .ticket-create__frame{ height:640px; }
}

  .svc-modal{ position:fixed; inset:0; display:none; z-index:9999; }
  .svc-modal.is-open{ display:block; }
  .svc-modal__backdrop{ position:absolute; inset:0; background:rgba(2,6,23,.55); }
  .svc-modal__panel{
    position:relative;
    width:min(860px, calc(100% - 32px));
    margin:40px auto;
    background:#fff;
    border-radius:16px;
    border:1px solid #e2e8f0;
    box-shadow:0 28px 80px rgba(0,0,0,.25);
    overflow:hidden;
  }
  .svc-modal__head{ display:flex; align-items:center; justify-content:space-between; gap:10px; padding:14px 16px; background:#f8fafc; border-bottom:1px solid #e2e8f0; }
  .svc-modal__title{ font-weight:900; color:#0f172a; display:flex; align-items:center; gap:10px; }
  .svc-modal__body{ padding:16px; }
  .svc-grid{ display:grid; grid-template-columns:1fr 1fr; gap:12px; }
  .svc-actions{ display:flex; justify-content:flex-end; margin-top:14px; }
  .svc-error{ background:#fef2f2; border:1px solid #fecaca; color:#991b1b; padding:10px 12px; border-radius:12px; font-weight:700; margin-bottom:12px; }
  @media (max-width: 820px){
    .svc-grid{ grid-template-columns:1fr; }
  }
/* Services Buttons – scoped */
.svc-actions{ display:flex; justify-content:flex-end; gap:10px; flex-wrap:wrap; }

.svc-btn{
  display:inline-flex; align-items:center; gap:8px;
  padding:10px 14px;
  border-radius:12px;
  border:1px solid #e2e8f0;
  background:#ffffff;
  color:#0f172a;
  font-weight:900;
  font-size:13px;
  text-decoration:none;
  cursor:pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease, border-color .12s ease;
  box-shadow: 0 4px 14px rgba(2,6,23,.06);
}
.svc-btn:hover{
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(2,6,23,.10);
  background:#f8fafc;
}

/* Varianten */
.svc-btn--primary{
  background:#eaf2ff;
  border-color:#b9d2ff;
  color:#004a99;
}
.svc-btn--primary:hover{ background:#dfeaff; }

.svc-btn--danger{
  background:#fef2f2;
  border-color:#fecaca;
  color:#b91c1c;
}
.svc-btn--danger:hover{ background:#fee2e2; }

.svc-btn--muted{
  background:#f8fafc;
  border-color:#e2e8f0;
  color:#334155;
}
.svc-btn--muted:hover{ background:#f1f5f9; }

/* Button als <button> */
button.svc-btn{ appearance:none; }

/* Icon spacing */
.svc-btn i{ font-size:14px; }
 .svc-actions{ display:flex; justify-content:flex-end; gap:10px; flex-wrap:wrap; }

  .svc-iconbtn{
    width:40px; height:40px;
    display:inline-flex; align-items:center; justify-content:center;
    border-radius:12px;
    border:1px solid #e2e8f0;
    background:#fff;
    cursor:pointer;
    box-shadow: 0 4px 14px rgba(2,6,23,.06);
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
  }
  .svc-iconbtn:hover{
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(2,6,23,.10);
    background:#f8fafc;
  }

  .svc-iconbtn--danger{ background:#fef2f2; border-color:#fecaca; color:#b91c1c; }
  .svc-iconbtn--danger:hover{ background:#fee2e2; }

  .svc-iconbtn--primary{ background:#eaf2ff; border-color:#b9d2ff; color:#004a99; }
  .svc-iconbtn--primary:hover{ background:#dfeaff; }

  .svc-iconbtn--muted{ background:#f8fafc; border-color:#e2e8f0; color:#334155; }
  /* =========================
   SERVICES 2-COLUMN FIX
   (admin_services + services)
   ========================= */

main .grid-2col{
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 18px;
  align-items: start;
}

main .grid-2col > section,
main .grid-2col > aside{
  min-width: 0;
}
/* =========================================
   admin_services.php – 2 Column Layout (scoped, stable)
   ========================================= */
.admin-services-page .grid-2col{
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 380px !important;
  gap: 18px !important;
  align-items: start !important;
}

.admin-services-page .grid-2col > section,
.admin-services-page .grid-2col > aside{
  min-width: 0 !important;
}

/* erst bei kleineren Viewports stacken (nicht 1100!) */
@media (max-width: 980px){
  .admin-services-page .grid-2col{
    grid-template-columns: 1fr !important;
  }
}
    .tabs-nav { display: flex; gap: 5px; margin-bottom: 25px; border-bottom: 2px solid #edf2f7; }
    .tab-btn { padding: 12px 24px; cursor: pointer; border: none; background: none; font-weight: 600; color: #718096; }
    .tab-btn.active { color: #3182ce; border-bottom: 2px solid #3182ce; }
    .tab-content { display: none; }
    .tab-content.active { display: block; }
    .matrix-box { display: grid; grid-template-columns: 1fr 1fr 150px; gap: 15px; background: #f7fafc; padding: 20px; border-radius: 8px; margin-bottom: 20px; border: 1px solid #e2e8f0; align-items: flex-end; }
    .loading-overlay { display: none; position: fixed; inset: 0; background: rgba(255,255,255,0.7); z-index: 10000; align-items: center; justify-content: center; flex-direction: column; }
    .loading-overlay.is-active { display: flex; }
    .spinner { width: 40px; height: 40px; border: 4px solid #f3f3f3; border-top: 4px solid #3182ce; border-radius: 50%; animation: spin 1s linear infinite; }
    .svc-modal { display: none; position: fixed; inset: 0; z-index: 9999; background: rgba(0,0,0,0.5); align-items: center; justify-content: center; }
    .svc-modal.is-open { display: flex; }
    .svc-modal__panel { background: #fff; width: 95%; max-width: 800px; border-radius: 12px; overflow: hidden; }
    .status-archived { opacity: 0.5; background: #f8fafc; text-decoration: line-through; }
    .btn-invoice { color: #38a169; background: #f0fff4; border: 1px solid #c6f6d5; }
    @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.tabs-wrapper { display: flex; gap: 10px; margin-bottom: 20px; border-bottom: 2px solid #edf2f7; }
    .tab-item { padding: 12px 20px; cursor: pointer; font-weight: 600; color: #718096; border-bottom: 2px solid transparent; margin-bottom: -2px; }
    .tab-item.is-active { color: #3182ce; border-bottom-color: #3182ce; }
    .matrix-box { display: grid; grid-template-columns: 1.5fr 1.5fr 1fr 160px; gap: 15px; background: #f8fafc; padding: 20px; border-radius: 12px; border: 1px solid #e2e8f0; margin-bottom: 25px; align-items: flex-end; }
    .svc-modal-content { background: #fff; width: 100%; max-width: 650px; border-radius: 12px; overflow: hidden; }
    .loading-overlay { display: none; position: fixed; inset: 0; background: rgba(255,255,255,0.8); z-index: 10001; align-items: center; justify-content: center; flex-direction: column; }
    .loading-overlay.is-active { display: flex; }
    .spinner { width: 40px; height: 40px; border: 4px solid #f3f3f3; border-top: 4px solid #3182ce; border-radius: 50%; animation: spin 1s linear infinite; }
    @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
    .archived-row { opacity: 0.6; filter: grayscale(1); background: #fdfdfd; }
    .crm-modal__viewer { width: 100%; height: 100%; display: flex; }
.crm-modal__frame { width: 100%; height: 100%; border: none; }
.crm-modal__img { max-width: 100%; max-height: 100%; object-fit: contain; }
/* Container für den Inhalt im Modal */
.crm-modal__body {
    flex-grow: 1;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #525659; /* Klassisches PDF-Grau für den Hintergrund */
    display: flex;
    flex-direction: column;
}

/* Spezifisch für den iFrame der view_receipt.php */
.crm-modal__body iframe {
    width: 100%;
    height: 100%;
    border: none;
    flex-grow: 1;
}

/* Falls es mal ein Bild (JPG/PNG) ist */
.crm-modal__body img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    margin: auto;
}
/* Container & Buttons */
.perm-actions { display: flex; gap: 8px; margin-bottom: 15px; }
.btn-perm-all { 
    font-size: 0.75rem; padding: 5px 10px; border-radius: 4px; 
    border: 1px solid #e2e8f0; background: #fff; cursor: pointer; color: #64748b; 
}
.btn-perm-all:hover { background: #f8fafc; color: #3b82f6; border-color: #3b82f6; }

/* Container für die Liste */
.perm-grid-list {
    display: flex;
    flex-direction: column;
    gap: 4px; /* Engerer Abstand zwischen den Zeilen */
    padding: 5px 0;
}

/* Die Zeile - Jetzt ohne festen Hintergrund-Block */
.perm-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    /* Verhindert den "fetten" weißen Rahmen */
    background: transparent; 
    border: none;
    width: fit-content; /* Der Rahmen passt sich der Textlänge an */
    min-width: 300px;   /* Sorgt für eine schöne Ausrichtung */
}

/* Hover-Effekt: Nur eine ganz dezente Färbung */
.perm-row:hover {
    background-color: #f1f5f9;
}

/* Die Checkbox selbst (wie in deinem Screenshot) */
.perm-row input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #3b82f6; /* Blauer Rahmen im Standard */
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    display: grid;
    place-content: center;
    transition: all 0.1s;
}

.perm-row input[type="checkbox"]:checked {
    background-color: #3b82f6;
}

.perm-row input[type="checkbox"]::before {
    content: "\f00c";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 10px;
    color: #fff;
    display: none;
}

.perm-row input[type="checkbox"]:checked::before {
    display: block;
}

/* Text-Styling */
.perm-row span {
    font-size: 0.9rem;
    color: #334155;
    font-weight: 500;
}
.tot-row--neg span, .tot-row--neg strong {
    color: #e11d48 !important; /* Ein kräftiges Rot */
}
/* ==========================================================================
   INVOICE MODULE - CREDIT NOTES & CANCEL STYLES
   ========================================================================== */

/* Zeilen-Markierung in der Tabelle */
.crm-table tr.is-credit-note {
    background-color: rgba(219, 234, 254, 0.3) !important; /* Sanftes Blau für Gutschriften */
}

/* Badge für den Dokumententyp (RE/GS) */
.badge-type {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    margin-right: 10px;
    min-width: 32px;
}

.type-invoice {
    background-color: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.type-credit-note {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Storno-Optik für stornierte Rechnungen */
tr.status-canceled {
    opacity: 0.6;
}

tr.status-canceled td:not(:last-child) {
    text-decoration: line-through;
    color: var(--crm-muted);
}

/* Status-Pills Erweiterung */
.invoice-status-pill.is-canceled {
    background-color: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

/* Betrags-Farben */
.amount-negative {
    color: #1e40af;
    font-weight: 900;
}

/* Totals-Rows für PDF und View */
.tot-row--neg span, 
.tot-row--neg strong {
    color: #e11d48 !important; /* Rabatte/Gutschriften in Rot */
}

/* Sidebar "Gefahrenzone" */
.invoice-side-card.danger-zone {
    border-top: 3px solid #ef4444;
}
/* Standardmäßig: Button unsichtbar (PC, Laptop, großes Tablet) */
.mobile-nav-toggle {
    display: none !important;
}

/* Nur bei Bildschirmen kleiner als 992px (Smartphone & kleine Tablets) */
@media (max-width: 992px) {
    .mobile-nav-toggle {
        display: flex !important;
    }

    /* Sidebar auf Mobile standardmäßig einklappen */
    .sidebar-new {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    /* Sidebar ausfahren, wenn Toggle-Button gedrückt wurde (.is-open wird per JS gesetzt) */
    .sidebar-new.is-open {
        transform: translateX(0);
        box-shadow: 5px 0 20px rgba(0,0,0,0.2);
    }

    /* Inhalt auf Mobile über volle Breite */
    .main-content {
        margin-left: 0 !important;
    }
}
/* =========================
   SIDEBAR SETUP MODULES
   ========================= */
.module-row-clean {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px; /* Mehr vertikales Padding für Präsenz */
    margin-bottom: 8px;
    border-radius: var(--crm-radius);
    transition: all 0.2s ease;
    cursor: pointer;
    border: 1px solid transparent;
}

.module-row-clean:hover {
    background: #f8fafc;
    border-color: var(--crm-border);
}
.module-row-clean .f-label {
    font-size: 15px !important; /* Deutlich lesbarer */
    color: var(--crm-text);
    margin-bottom: 4px;
}

.module-row-clean .f-hint {
    font-size: 13px; /* Größere Subline */
}

/* Fix für das Schieberegler-Alignment */
.module-row-clean .switch {
    margin-left: 20px; /* Sicherer Abstand zum Text */
}
.module-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.module-icon-box {
    width: 40px;
    height: 40px;
    background: #f1f5f9;
    color: var(--p-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}
/* =========================================
   SWITCH / TOGGLE UI
   ========================================= */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #cbd5e1;
    transition: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

input:checked + .slider {
    background-color: var(--crm-primary);
}

input:checked + .slider:before {
    transform: translateX(20px);
}
.content-inner--narrow {
    max-width: 900px; /* Perfekte Balance zwischen 800 und 1100 */
    margin: 0 auto;
}

.module-row-clean {
    padding: 14px 20px;
    margin-bottom: 4px; /* Etwas kompakterer vertikaler Fluss */
}

/* Verhindert, dass der Text zu weit vom Toggle wegwandert */
.module-info {
    flex: 1; 
    min-width: 0;
}
/* Kalender Container & Grid */
.calendar-light-grid {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
}

.grid-content {
    display: grid;
    grid-template-columns: 60px repeat(7, 1fr);
    height: 700px;
    overflow-y: auto;
    background-image: linear-gradient(var(--crm-border) 1px, transparent 1px);
    background-size: 100% 50px;
    scroll-behavior: smooth;
}

/* Event-Einträge im Grid */
.calendar-event-card {
    position: absolute;
    left: 4px;
    right: 4px;
    background: var(--p-blue);
    color: #ffffff;
    padding: 6px 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    border: none;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-event-card:hover {
    transform: scale(1.02);
    z-index: 100;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

.calendar-event-card.category-deadline {
    background: #ef4444;
}

.calendar-event-card.category-task {
    background: #10b981;
}

/* Zeitlinie */
#live-time-line {
    transition: top 60s linear;
}
/* Calendar Layout */
.calendar-wrapper {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 25px;
    align-items: start;
}

.calendar-light-grid {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.04);
    overflow: hidden;
}

/* Grid Structure */
.grid-header {
    display: grid;
    grid-template-columns: 60px repeat(7, 1fr);
    background: #ffffff;
    border-bottom: 1px solid #f1f5f9;
    text-align: center;
    padding: 15px 0;
}

.grid-day-label {
    font-size: 10px;
    font-weight: 800;
    color: #94a3b8;
    text-transform: uppercase;
}

.grid-day-num {
    font-size: 18px;
    font-weight: 800;
    display: block;
    margin-top: 4px;
    color: #1e293b;
}

.grid-day-num.today {
    color: #fff;
    background: var(--p-blue);
    width: 34px;
    height: 34px;
    line-height: 34px;
    border-radius: 8px;
    margin: 4px auto 0;
}

.grid-content {
    display: grid;
    grid-template-columns: 60px repeat(7, 1fr);
    height: 700px;
    overflow-y: auto;
    position: relative;
    background-image: linear-gradient(#f1f5f9 1px, transparent 1px);
    background-size: 100% 50px;
}

/* Columns */
.time-col {
    border-right: 1px solid #f1f5f9;
    color: #94a3b8;
    font-size: 10px;
    font-weight: 700;
    text-align: right;
    padding-right: 10px;
    background: #fcfcfd;
}

.time-slot-label {
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.day-col {
    border-right: 1px solid #f1f5f9;
    position: relative;
}

/* Live Time Indicator */
.current-time-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: #ef4444; 
    z-index: 50;
    pointer-events: none;
}

.current-time-line::before {
    content: '';
    position: absolute;
    left: -4px;
    top: -4px;
    width: 10px;
    height: 10px;
    background: #ef4444;
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

/* Cards */
.calendar-event-card {
    position: absolute;
    left: 4px;
    right: 4px;
    background: var(--p-blue);
    color: #fff;
    padding: 6px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.15);
    cursor: pointer;
    min-height: 40px;
    border: none;
}

.event-time { opacity: 0.8; font-size: 9px; }
.event-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Categories */
.category-deadline { background: #ef4444 !important; }
.category-task { background: #10b981 !important; }

/* Sidebar Utilities */
.calendar-sidebar { display: flex; flex-direction: column; gap: 20px; }
.border-none { border: none !important; }
.sidebar-text { font-size: 12px; color: var(--crm-muted); line-height: 1.6; }
.filter-options { margin-top: 10px; }
.check-container { display: flex; align-items: center; font-size: 13px; margin-bottom: 10px; cursor:pointer; }
.check-container input { margin-right: 10px; }
/* ADMIN-STYLE MODAL OVERRIDES */
.crm-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.crm-modal.is-open {
  display: flex;
}

.crm-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px); /* Der Hintergrund-Effekt aus der Admin-Ansicht */
}

.crm-modal__panel {
  position: relative;
  background: #fff;
  width: 100%;
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  animation: modalPop 0.2s ease-out;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.crm-modal__head {
  padding: 20px 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #eef2f7;
}

.crm-modal__title {
  font-size: 18px;
  font-weight: 900;
  color: var(--crm-text);
}
/* Verhindert die hässlichen Standard-Icons in Chrome/Safari */
.date-field-clean::-webkit-calendar-picker-indicator {
    background: transparent;
    bottom: 0;
    color: transparent;
    cursor: pointer;
    height: auto;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    width: auto;
}

.date-field-clean {
    position: relative;
    height: 52px !important;
    padding: 0 16px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 14px !important;
    background: #fff !important;
    font-size: 15px !important;
    color: #64748b !important;
    appearance: none;
    -webkit-appearance: none;
    display: flex;
    align-items: center;
}

/* Der Container sorgt dafür, dass das Feld wie eine cleane Box wirkt */
.custom-date-input {
    position: relative;
    display: flex;
    align-items: center;
}

.date-field-clean:focus {
    border-color: var(--crm-primary) !important;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1) !important;
    color: var(--crm-text) !important;
}
/* Container für das saubere Datum */
.date-input-wrapper {
  position: relative;
  width: 100%;
}

.clean-datetime-field {
  width: 100%;
  height: 50px;
  padding: 0 16px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  font-size: 14px;
  color: #1e293b;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

/* Versteckt ALLE Standard-Browser-Icons (Datum/Uhrzeit) */
.clean-datetime-field::-webkit-calendar-picker-indicator {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* Das eigene Icon rechts */
.calendar-icon-overlay {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
}
/* Blendet den Scrollbalken der Tab-Leiste komplett aus */
.tabs::-webkit-scrollbar {
    display: none !important; /* Chrome, Safari, Opera */
}

.tabs {
    -ms-overflow-style: none !important;  /* IE and Edge */
    scrollbar-width: none !important;  /* Firefox */
    border-bottom: none !important; /* Verhindert Doppel-Linie */
}

/* Stellt sicher, dass der tab-body niemals breiter als die Card ist */
.tab-body {
    box-sizing: border-box !important;
}

/* Verhindert, dass die Grid-Spalte sich ausdehnt */
.split-grid section {
    min-width: 0;
}
/* Spezielle Korrekturen für mobile Endgeräte (iPhone) */
@media (max-width: 768px) {
    /* Erzwingt volle Breite für alle Grid-Container */
    .dashboard-grid, 
    .split-grid, 
    .grid-3-col {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        padding: 0 !important;
        gap: 15px !important;
        align-items: stretch !important;
    }

    /* Alle Karten (Kacheln) auf 100% Breite setzen */
    .crm-card, 
    .dashboard-card, 
    .panel-card {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        border-radius: 12px !important; /* Einheitliche Rundung für iPhone */
    }

    /* Dashboard Boxen auf eine exakt gleiche Höhe zwingen und scrollbar machen */
    .dashboard-grid .crm-card.dashboard-card {
        height: 380px !important;
        display: flex !important;
        flex-direction: column !important;
    }
    .dashboard-grid .crm-card.dashboard-card .card-body {
        flex: 1 1 auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important; /* Weiches Scrollen auf iOS */
    }


    /* Korrektur für den Inhalts-Container, damit nichts am Rand klebt */
    .content-inner {
        padding: 10px 15px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* 1. Kassenbuch & Dashboard Karten stapeln */
    .split-grid, .dashboard-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
    }

    /* 2. Formular-Felder optimieren */
    .form-control, .clean-datetime-field {
        font-size: 16px !important; /* Verhindert das automatische Zoomen des iPhones beim Tippen */
        height: 48px !important;
    }

    /* 3. Rechnungs-Tabelle mobil handhabbar machen */
    .invoice-table-row {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
        padding: 15px !important;
        border-bottom: 2px solid #eef2f7 !important;
    }
    
    .invoice-table-row .desc-col {
        grid-column: span 2 !important;
    }

    /* 4. Tab-Navigation (Verlauf, Kalender etc.) */
    .tabs {
        padding-bottom: 5px !important;
        -webkit-overflow-scrolling: touch !important;
    }
.invoice-header-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
    }

    /* Positionen: Jede Zeile wird zur eigenen kleinen Karte */
    .invoice-table-header {
        display: none !important; /* Kopfzeile ausblenden */
    }

    .invoice-item-row {
        display: block !important;
        background: #f8fafc !important;
        padding: 15px !important;
        border-radius: 12px !important;
        margin-bottom: 10px !important;
        border: 1px solid #eef2f7 !important;
    }

    .invoice-item-row input, 
    .invoice-item-row select {
        width: 100% !important;
        margin-bottom: 8px !important;
    }
.system-info-list div {
    padding: 12px 18px !important;
    background: #fff !important;
    margin-bottom: 6px !important;
    border-radius: 10px !important;
    border: 1px solid #eef2f7 !important;
    font-weight: 700 !important;
}

/* Den "Abbrechen" Button im Rechnungsformular griffiger machen */
.btn-row .btn {
    height: 44px !important; /* Bessere Touch-Fläche */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
}
/* In deine style.css oder header.inc.php */
.nav-badge {
    background-color: #d90429; /* Sattes Rot */
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 50px;
    margin-left: 5px;
    display: inline-block;
    line-height: 1;
    vertical-align: middle;
    box-shadow: 0 0 10px rgba(217, 4, 41, 0.4);
}
    /* Stellt sicher, dass das Desktop Logo groß ist */
.logo-desktop {
    display: block !important;
    height: 150px !important; /* Vergrößert auf ursprünglichen Wert */
}
.logo-mobile {
    display: none !important;
}

/* MOBILE ANPASSUNGEN */
@media (max-width: 768px) {
    /* 1. Burger-Button befreien (min-width löschen) */
    .header-logo-section {
        min-width: auto !important;
        padding-left: 10px !important;
        flex: 0 0 auto !important;
    }

    /* 2. Logo-Tausch */
    .logo-desktop {
        display: none !important;
    }
    .logo-mobile {
        display: block !important;
        height: 45px !important;
    }
.logo-area {
        width: 180px !important; 
        min-width: 180px !important;
    }

    /* 3. Platz schaffen für Icons */
    .header-clock, .header-username {
        display: none !important;
    }
    .header-right {
        gap: 15px !important;
        padding-right: 15px !important;
    }
}
/* Pulsierende Animation für Badges (Messenger & Tickets) */
.n-badge, .hdr-msg__badge, .pulse-animation {
    animation: pulse-red 2s infinite;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
}

@keyframes pulse-red {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* Sidebar-Icons bei Hover leicht anheben */
.sidebar-new .nav-link:hover i {
    transform: translateY(-2px);
    transition: transform 0.2s ease;
    color: var(--a-cyan);
}
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 24px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: #3b82f6; }
input:checked + .slider:before { transform: translateX(20px); }
.amount-fixed {
    font-family: 'Inter', sans-serif;
    font-variant-numeric: tabular-nums; /* Alle Zahlen sind exakt gleich breit */
    font-feature-settings: "tnum";      /* Fallback für ältere Browser */
    letter-spacing: -0.01em;           /* Dezenter Tech-Look */
    font-weight: 600;                  /* Semi-Bold für gute Lesbarkeit */
}

/* Optional: Farbe für positive/negative Beträge */
.amount-pos { color: var(--crm-success); }
.amount-neg { color: var(--crm-danger); } 

/* =========================================
   EDIT USER (MOBILE OPTIMIERUNG & LAYOUT)
========================================= */
.personal-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
    align-items: start;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 11px;
    font-weight: 900;
    color: #64748b;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

@media (max-width: 900px) {
    .personal-grid {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
    }
    .form-row {
        grid-template-columns: 1fr !important;
        gap: 0 !important;
    }
    .action-group {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 10px;
        margin-top: 10px;
    }
    .action-group .btn {
        width: 100%;
        justify-content: center;
    }
    .card-head.flex-between {
        flex-direction: column;
        align-items: stretch;
    }
    .btn-group-sm {
        display: flex;
        width: 100%;
        gap: 10px;
    }
    .btn-group-sm .btn {
        flex: 1;
        justify-content: center;
    }
}
.crm-help-btn {
    /* Layout & Kreis-Form */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    
    /* Farben (Hellblauer Kreis, dunkelblaues ?) */
    background-color: #e0f2fe;
    color: #004a99;
    
    /* Typografie & Ränder */
    font-size: 14px;
    font-weight: 800;
    border: none;
    outline: none;
    
    /* Verhalten */
    cursor: pointer;
    vertical-align: middle;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 2px 4px rgba(0, 74, 153, 0.1);
    
    /* Verhindert Text-Markierung beim Doppelklick */
    user-select: none;
}

/* Schöner Hover-Effekt beim Drüberfahren */
.crm-help-btn:hover {
    background-color: #bfdbfe;
    color: #003366;
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0, 74, 153, 0.15);
}