:root{
  --bg:#f5f7fb;
  --surface:#ffffff;
  --border:#e7edf6;
  --text:#0b1220;
  --muted:#6b7a90;
  --primary:#0b63ce;
  --primary-2:#0a56b3;
  --shadow: 0 10px 30px rgba(10, 30, 80, .08);
  --radius: 16px;

  /* Badge-Farben (hell) */
  --badge-blue-bg: color-mix(in srgb, var(--primary) 12%, var(--surface));
  --badge-blue-bd: color-mix(in srgb, var(--primary) 26%, var(--border));
  --badge-blue-tx: color-mix(in srgb, var(--primary) 90%, #000);

  --badge-green-bg: color-mix(in srgb, #16a34a 12%, var(--surface));
  --badge-green-bd: color-mix(in srgb, #16a34a 26%, var(--border));
  --badge-green-tx: #0a7a3c;

  --badge-purple-bg: color-mix(in srgb, #7c3aed 12%, var(--surface));
  --badge-purple-bd: color-mix(in srgb, #7c3aed 26%, var(--border));
  --badge-purple-tx: #6d28d9;

  --badge-red-bg: color-mix(in srgb, #ef4444 12%, var(--surface));
  --badge-red-bd: color-mix(in srgb, #ef4444 26%, var(--border));
  --badge-red-tx: #b91c1c;
}

:root[data-theme="dark"]{
  --bg:#0a0f1a;
  --surface:#0f1726;
  --border:#1d2a3f;
  --text:#e9f0ff;
  --muted:#a6b3cc;
  --primary:#3aa0ff;
  --primary-2:#2c86da;
  --shadow: 0 10px 30px rgba(0,0,0,.35);

  /* Badge-Farben (dark) */
  --badge-blue-bg: color-mix(in srgb, var(--primary) 18%, transparent);
  --badge-blue-bd: color-mix(in srgb, var(--primary) 36%, var(--border));
  --badge-blue-tx: color-mix(in srgb, var(--primary) 85%, #fff);

  --badge-green-bg: color-mix(in srgb, #22c55e 16%, transparent);
  --badge-green-bd: color-mix(in srgb, #22c55e 36%, var(--border));
  --badge-green-tx: #4ade80;

  --badge-purple-bg: color-mix(in srgb, #a78bfa 16%, transparent);
  --badge-purple-bd: color-mix(in srgb, #a78bfa 36%, var(--border));
  --badge-purple-tx: #c4b5fd;

  --badge-red-bg: color-mix(in srgb, #fb7185 16%, transparent);
  --badge-red-bd: color-mix(in srgb, #fb7185 36%, var(--border));
  --badge-red-tx: #fb7185;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Helvetica Neue", Helvetica, sans-serif;
  background:var(--bg);
  color:var(--text);
}

a{color:inherit}
.container{
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 14px 28px;
}

.topbar{
  position: sticky;
  top:0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner{
  max-width: 1200px;
  margin:0 auto;
  padding: 12px 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
  min-width: 200px;
}

/* Logo-Badge nur in der Topbar (damit Status-Badges nicht kaputt gehen) */
.brand .badge{
  width:34px;
  height:34px;
  border-radius:10px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 70%, #ffffff), var(--primary));
  display:grid;
  place-items:center;
  color:#fff;
  font-weight:800;
  box-shadow: var(--shadow);
}

.brand-title{line-height:1.05}
.brand-title b{display:block;font-size:14px}
.brand-title span{display:block;font-size:12px;color:var(--muted)}

.nav{
  display:flex; gap:10px; align-items:center;
}
.nav a{
  text-decoration:none;
  font-size:14px;
  padding:10px 12px;
  border-radius: 12px;
  color: var(--muted);
}
.nav a.active{
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(10,30,80,.05);
}

.actions{
  display:flex; gap:10px; align-items:center;
  justify-content:flex-end;
  min-width: 220px;
}
.btn{
  border:1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  cursor:pointer;
  font-size:14px;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
}
.btn:hover{filter:brightness(0.98)}
.btn.primary{
  border-color: transparent;
  background: var(--primary);
  color:#fff;
}
.btn.primary:hover{background: var(--primary-2)}
.btn.icon{display:flex;align-items:center;gap:8px}

.pill{
  font-size:12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
}

/* Typo Helfer */
.h1{
  margin: 18px 0 6px;
  font-size: 30px;
  letter-spacing: -0.02em;
}
.h2{
  margin:0;
  font-size:18px;
  font-weight:900;
}
.small{
  font-size:12px;
  color: var(--muted);
}
.sub{
  margin:0 0 18px;
  color: var(--muted);
  font-size:14px;
}
.muted{ color: var(--muted); }

/* Layout */
.grid4{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad{padding:16px}
.kpi{
  display:flex;justify-content:space-between;gap:10px;align-items:flex-start;
}
.kpi .label{font-size:13px;color:var(--muted)}
.kpi .value{font-size:26px;font-weight:800;margin-top:8px}
.kpi .hint{font-size:12px;color:var(--muted);margin-top:6px}
.kpi .ico{
  width:34px;height:34px;border-radius:12px;
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border));
  display:grid;place-items:center;
  color: var(--primary);
  font-weight:900;
}

.section-head{
  display:flex;align-items:center;justify-content:space-between;
  margin: 18px 0 10px;
}
.section-head h2{margin:0;font-size:18px}

.tablehead{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}

/* Table */
.tablewrap{
  overflow:auto;
  -webkit-overflow-scrolling: touch;
}
.table{
  width:100%;
  border-collapse: collapse;
}
.table th, .table td{
  text-align:left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size:14px;
  vertical-align: middle;
}
.table th{
  color:var(--muted);
  font-weight:700;
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.04em
}

/* Status-Badges (für Tabelle) */
.badge{
  /* Achtung: das ist auch dein Logo-Badge. Damit wir nix kaputt machen,
     greifen wir Status-Badges nur an, wenn sie in Tabellen sind: */
}

.table .badge{
  width:auto;
  height:auto;
  border-radius: 999px;
  padding: 7px 12px;
  font-size:12px;
  font-weight:800;
  letter-spacing: .01em;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  color: var(--text);
  box-shadow: none;

  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;

  min-width: 118px;
  white-space: nowrap;
  line-height: 1.1;
}

.table .badge-blue{
  background: var(--badge-blue-bg);
  border-color: var(--badge-blue-bd);
  color: var(--badge-blue-tx);
}
.table .badge-green{
  background: var(--badge-green-bg);
  border-color: var(--badge-green-bd);
  color: var(--badge-green-tx);
}
.table .badge-purple{
  background: var(--badge-purple-bg);
  border-color: var(--badge-purple-bd);
  color: var(--badge-purple-tx);
}
.table .badge-red{
  background: var(--badge-red-bg);
  border-color: var(--badge-red-bd);
  color: var(--badge-red-tx);
}

.tag{
  display:inline-flex;align-items:center;gap:8px;
  padding:6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  font-size:12px;
  color: var(--muted);
}
.tag.ok{color:#0a7a3c;border-color: color-mix(in srgb, #0a7a3c 25%, var(--border));background: color-mix(in srgb, #0a7a3c 10%, var(--surface))}
.tag.wait{color:#9a6a00;border-color: color-mix(in srgb, #9a6a00 25%, var(--border));background: color-mix(in srgb, #9a6a00 10%, var(--surface))}
.tag.no{color:#9b1c1c;border-color: color-mix(in srgb, #9b1c1c 25%, var(--border));background: color-mix(in srgb, #9b1c1c 10%, var(--surface))}

.mobile-actions{
  display:none;
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 20;
}
.fab{
  padding: 14px 16px;
  border-radius: 999px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 18px 45px rgba(0,0,0,.25);
  cursor:pointer;
}

@media (max-width: 980px){
  .grid4{grid-template-columns: repeat(2, 1fr)}
  .brand{min-width:auto}
  .actions{min-width:auto}
  .container{padding: 16px 12px 26px;}
}

@media (max-width: 680px){
  .nav{display:none;}
  .grid4{grid-template-columns: 1fr}
  .mobile-actions{display:block}
  .h1{font-size:26px}
  .btn{padding: 10px 12px}
}

/* ---------- Alerts (Theme-aware) ---------- */
.alert{
  border-radius: 16px;
  padding: 16px 18px;
  border: 1px solid var(--border);
}

.alert .alert-title{
  font-weight: 900;
  margin-bottom: 6px;
}

.alert .alert-text{
  line-height: 1.45;
  white-space: pre-wrap;
}

/* LIGHT (Default) */
.alert-error{
  background: linear-gradient(180deg, #fff5f5 0%, #ffeaea 100%);
  border-color: rgba(220, 60, 60, .28);
  box-shadow: 0 10px 25px rgba(0,0,0,.08);
}

.alert-error .alert-title{
  color: #b42323;
}

.alert-error .alert-text{
  color: #3a1f1f;
}

/* DARK (nur wenn data-theme="dark") */
html[data-theme="dark"] .alert-error{
  background: linear-gradient(180deg, rgba(255,70,70,.16) 0%, rgba(0,0,0,.20) 100%);
  border-color: rgba(255, 90, 90, .40);
  box-shadow: 0 14px 40px rgba(0,0,0,.35);
}

html[data-theme="dark"] .alert-error .alert-title{
  color: #ff6b6b;
}

html[data-theme="dark"] .alert-error .alert-text{
  color: rgba(255, 235, 235, .92);
}



/* =========================================================
   Alert – Error (Theme-aware)
   ========================================================= */

.alert {
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 14px;
}

.alert-title {
  font-weight: 800;
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}

.alert-text {
  line-height: 1.45;
  opacity: 0.95;
}

/* -------- LIGHT THEME -------- */
:root .alert-error {
  background: linear-gradient(135deg, #ffe5e5, #ffd2d2);
  border: 1px solid #ffb3b3;
  color: #7a0b0b;
}

:root .alert-error .alert-title {
  color: #a40000;
}

/* -------- DARK THEME -------- */
[data-theme="dark"] .alert-error {
  background: linear-gradient(135deg, #2a0f12, #180709);
  border: 1px solid #5a1d22;
  color: #ffd6d9;
}

[data-theme="dark"] .alert-error .alert-title {
  color: #ff6b6b;
}

/* =========================================
   FORCE: Show Header Badge + Score Card
   (damit es garantiert greift)
   ========================================= */

.pagehead .sub .app-status-badge{
  display:inline-flex !important;
  align-items:center !important;
  gap:10px !important;
  padding:8px 12px !important;
  border-radius:999px !important;
  font-weight:900 !important;
  line-height:1 !important;
  border:1px solid transparent !important;
  box-shadow: 0 10px 22px rgba(0,0,0,.06) !important;
}

.pagehead .sub .app-status-badge .status-dot{
  width:10px !important;
  height:10px !important;
  border-radius:50% !important;
  background: currentColor !important;
}

/* LIGHT Variants */
.pagehead .sub .badge.badge-blue.app-status-badge{
  background: rgba(37, 99, 235, .10) !important;
  border-color: rgba(37, 99, 235, .22) !important;
  color: #1d4ed8 !important;
}
.pagehead .sub .badge.badge-purple.app-status-badge{
  background: rgba(147, 51, 234, .10) !important;
  border-color: rgba(147, 51, 234, .22) !important;
  color: #7c3aed !important;
}
.pagehead .sub .badge.badge-green.app-status-badge{
  background: rgba(22, 163, 74, .10) !important;
  border-color: rgba(22, 163, 74, .22) !important;
  color: #15803d !important;
}
.pagehead .sub .badge.badge-red.app-status-badge{
  background: rgba(220, 38, 38, .10) !important;
  border-color: rgba(220, 38, 38, .22) !important;
  color: #b91c1c !important;
}

/* DARK Theme */
html[data-theme="dark"] .pagehead .sub .app-status-badge{
  background: rgba(255,255,255,.06) !important;
  border-color: rgba(255,255,255,.10) !important;
  color: rgba(255,255,255,.92) !important;
  box-shadow: 0 18px 34px rgba(0,0,0,.38) !important;
}
html[data-theme="dark"] .pagehead .sub .app-status-badge .status-dot{
  box-shadow: 0 0 0 3px rgba(255,255,255,.10) !important;
}
html[data-theme="dark"] .pagehead .sub .badge.badge-blue.app-status-badge{
  background: rgba(59,130,246,.16) !important;
  border-color: rgba(59,130,246,.26) !important;
  color: #dbeafe !important;
}
html[data-theme="dark"] .pagehead .sub .badge.badge-purple.app-status-badge{
  background: rgba(168,85,247,.16) !important;
  border-color: rgba(168,85,247,.26) !important;
  color: #f3e8ff !important;
}
html[data-theme="dark"] .pagehead .sub .badge.badge-green.app-status-badge{
  background: rgba(34,197,94,.14) !important;
  border-color: rgba(34,197,94,.22) !important;
  color: #dcfce7 !important;
}
html[data-theme="dark"] .pagehead .sub .badge.badge-red.app-status-badge{
  background: rgba(239,68,68,.14) !important;
  border-color: rgba(239,68,68,.22) !important;
  color: #fee2e2 !important;
}

/* SCORE CARD */
.pagehead .score-card.card.card-pad{
  min-width: 280px !important;
  border-radius: 18px !important;
  padding: 16px 16px 14px !important;
  border: 1px solid rgba(0,0,0,.08) !important;
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,255,255,.88)) !important;
  box-shadow: 0 14px 30px rgba(0,0,0,.08) !important;
}

.pagehead .score-card .score-value{
  font-size: 36px !important;
  font-weight: 950 !important;
  margin-top: 8px !important;
  line-height: 1 !important;
  color: rgba(15, 23, 42, .95) !important;
}
.pagehead .score-card .score-value.muted{
  color: rgba(15, 23, 42, .35) !important;
}
html[data-theme="dark"] .pagehead .score-card.card.card-pad{
  border: 1px solid rgba(255,255,255,.10) !important;
  background: linear-gradient(180deg, rgba(17,24,39,.86), rgba(17,24,39,.72)) !important;
  box-shadow: 0 18px 40px rgba(0,0,0,.45) !important;
}
html[data-theme="dark"] .pagehead .score-card .score-value{
  color: rgba(255,255,255,.92) !important;
}
html[data-theme="dark"] .pagehead .score-card .score-value.muted{
  color: rgba(255,255,255,.42) !important;
}

/* ===== Show: Meta Row (Badge + Pills) ===== */
.pagehead .app-meta-row{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:10px;
  margin-top:8px;
}

/* verhindert Overlap durch alte Styles */
.pagehead .app-meta-row .pill{
  margin-left:0 !important;
}

/* Badge: stabil, nicht abschneiden */
.pagehead .app-status-badge{
  display:inline-flex !important;
  align-items:center;
  white-space:nowrap;
  line-height:1;
  padding:8px 12px;
  border-radius:999px;
}

/* optional: kleiner Punkt links im Badge (ohne HTML-Änderung) */
.pagehead .app-status-badge::before{
  content:"";
  width:8px;
  height:8px;
  border-radius:999px;
  background: currentColor;
  margin-right:8px;
  opacity:.9;
}

/* Dark Theme: Badge minimal edler */
html[data-theme="dark"] .pagehead .app-status-badge{
  box-shadow: 0 14px 30px rgba(0,0,0,.35);
}

/* Light Theme: Badge minimal edler */
html:not([data-theme="dark"]) .pagehead .app-status-badge{
  box-shadow: 0 12px 24px rgba(0,0,0,.08);
}

/* ================================
   Status Badge (global, theme-aware)
   ================================ */
.status-badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 12px;
  border-radius:999px;
  font-size:12px;
  font-weight:900;
  letter-spacing:.01em;
  border:1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  color: var(--text);
  white-space:nowrap;
  line-height:1;
}

/* Punkt im Badge */
.status-badge::before{
  content:"";
  width:8px;
  height:8px;
  border-radius:999px;
  background: currentColor;
  opacity:.9;
}

/* Farbvarianten (funktionieren überall, nicht nur in .table) */
.status-badge.badge-blue{
  background: var(--badge-blue-bg);
  border-color: var(--badge-blue-bd);
  color: var(--badge-blue-tx);
}
.status-badge.badge-green{
  background: var(--badge-green-bg);
  border-color: var(--badge-green-bd);
  color: var(--badge-green-tx);
}
.status-badge.badge-purple{
  background: var(--badge-purple-bg);
  border-color: var(--badge-purple-bd);
  color: var(--badge-purple-tx);
}
.status-badge.badge-red{
  background: var(--badge-red-bg);
  border-color: var(--badge-red-bd);
  color: var(--badge-red-tx);
}

/* =========================================
   FIX: 4 KPI-Karten oben (Show.php) nebeneinander
   ========================================= */

/* Desktop: immer 4 nebeneinander */
.grid4.kpi-row{
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  align-items: stretch;
}

/* Cards sollen gleich hoch wirken */
.grid4.kpi-row > .card{
  height: 100%;
}

/* Tablet: 2 nebeneinander */
@media (max-width: 980px){
  .grid4.kpi-row{
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* Handy: 1 untereinander */
@media (max-width: 680px){
  .grid4.kpi-row{
    grid-template-columns: 1fr !important;
  }
}

/* =========================================================
   MOBILE RESPONSIVE UTILITIES (360px+)
   Zentrale Fixes für alle Dealer-Seiten
   ========================================================= */

/* -------- Global Overflow Prevention -------- */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* -------- Pagehead Mobile Fixes -------- */
@media (max-width: 680px) {
  .pagehead {
    margin-bottom: 12px;
  }

  .pagehead > div {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }

  .pagehead .h1 {
    font-size: 22px;
    margin: 10px 0 4px;
  }

  .pagehead .sub {
    font-size: 13px;
    margin-bottom: 10px;
  }

  /* Pills neben dem Titel - auf Mobile umbrechen */
  .pagehead [style*="display:flex"],
  .pagehead [style*="display: flex"] {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
}

/* -------- Table Mobile Fixes -------- */

/* Tablewrap: immer horizontal scrollbar auf Mobile */
@media (max-width: 800px) {
  .tablewrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -12px;
    padding: 0 12px;
  }

  .tablewrap .table {
    min-width: 700px;
  }

  /* Tabellen-Scroll-Hinweis */
  .tablewrap::after {
    content: "← Wischen für mehr →";
    display: block;
    text-align: center;
    font-size: 11px;
    color: var(--muted);
    padding: 8px 0 4px;
    opacity: 0.7;
  }

  .table th,
  .table td {
    padding: 10px 12px;
    font-size: 13px;
  }

  .table th {
    font-size: 11px;
  }
}

/* -------- Tablehead (Filter-Zeile) Mobile Fixes -------- */
@media (max-width: 680px) {
  .tablehead {
    flex-direction: column;
    align-items: stretch !important;
    gap: 12px;
  }

  .tablehead > div {
    width: 100%;
  }

  /* Filter-Formulare vollbreite Inputs */
  .tablehead form {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    width: 100%;
  }

  .tablehead form .input,
  .tablehead form input,
  .tablehead form select {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .tablehead form .btn {
    width: 100%;
    justify-content: center;
  }
}

/* -------- Cards Mobile Fixes -------- */
@media (max-width: 680px) {
  .card {
    border-radius: 12px;
    min-width: 0;
  }

  .card-pad {
    padding: 14px 12px;
  }

  /* KPI Cards kompakter */
  .kpi .value {
    font-size: 22px;
  }

  .kpi .ico {
    width: 30px;
    height: 30px;
  }
}

/* -------- Buttons Mobile Fixes -------- */
@media (max-width: 680px) {
  .btn {
    padding: 10px 14px;
    font-size: 13px;
    min-height: 44px; /* Touch-Target Minimum */
  }

  .btn.primary {
    width: 100%;
    justify-content: center;
  }

  /* Pill/Badge kleiner */
  .pill {
    font-size: 11px;
    padding: 5px 8px;
  }

  /* FAB mobile anpassen */
  .fab {
    padding: 12px 14px;
    font-size: 13px;
  }
}

/* -------- Form Inputs Mobile Fixes -------- */
@media (max-width: 680px) {
  .input,
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="tel"],
  input[type="number"],
  input[type="file"],
  select,
  textarea {
    width: 100%;
    max-width: 100%;
    min-width: 0 !important;
    font-size: 16px; /* Verhindert Zoom auf iOS */
    padding: 12px;
    border-radius: 10px;
  }

  /* Flexbox-Rows mit Inputs */
  [style*="display:flex"] .input,
  [style*="display: flex"] .input {
    flex: 1 1 100% !important;
    min-width: 0 !important;
  }
}

/* -------- Grid Utilities Mobile -------- */
@media (max-width: 680px) {
  .grid4 {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  /* Stats Grid (Applications Index) */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px;
  }
}

@media (max-width: 400px) {
  .stats-grid {
    grid-template-columns: 1fr !important;
  }
}

/* -------- Badge Fixes Mobile -------- */
@media (max-width: 680px) {
  .table .badge {
    min-width: auto;
    padding: 6px 10px;
    font-size: 11px;
  }

  .tag {
    font-size: 11px;
    padding: 5px 8px;
  }
}

/* -------- Modal Mobile Fixes -------- */
@media (max-width: 680px) {
  .modal-overlay,
  .f3-modal-backdrop {
    padding: 10px;
  }

  .modal-box,
  .f3-modal {
    width: 100%;
    max-width: 100%;
    margin: 0;
    border-radius: 12px;
  }

  .modal-body {
    padding: 14px;
  }

  .modal-header {
    padding: 14px;
  }
}

/* -------- Typography Mobile -------- */
@media (max-width: 680px) {
  .h1 {
    font-size: 22px;
    margin: 10px 0 4px;
  }

  .h2 {
    font-size: 16px;
  }

  .small {
    font-size: 11px;
  }

  .sub {
    font-size: 13px;
    margin-bottom: 12px;
  }
}

/* -------- Utility Classes for Mobile -------- */

/* Fullwidth on Mobile */
.m-fullwidth {
  width: 100% !important;
}

@media (max-width: 680px) {
  .m-fullwidth,
  .mobile-fullwidth {
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* Hide on Mobile */
@media (max-width: 680px) {
  .hide-mobile,
  .m-hide {
    display: none !important;
  }
}

/* Show only on Mobile */
.show-mobile,
.m-show {
  display: none !important;
}

@media (max-width: 680px) {
  .show-mobile,
  .m-show {
    display: block !important;
  }
}

/* Stack on Mobile (flex column) */
@media (max-width: 680px) {
  .m-stack {
    flex-direction: column !important;
    align-items: stretch !important;
  }
}

/* Prevent text overflow */
.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* Word break for long content */
.text-break {
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
}

/* -------- Topbar Mobile Refinements -------- */
@media (max-width: 680px) {
  .topbar-inner {
    padding: 10px 12px;
  }

  .brand {
    min-width: 0;
    flex: 1;
  }

  .brand-title b {
    font-size: 13px;
  }

  .brand-title span {
    font-size: 11px;
  }

  .brand .badge {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 12px;
  }

  .actions {
    min-width: auto;
    gap: 8px;
  }

  .actions .pill {
    display: none; /* Plan-Pill verstecken auf Mobile */
  }
}

/* -------- Section Head Mobile -------- */
@media (max-width: 680px) {
  .section-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin: 14px 0 10px;
  }

  .section-head h2 {
    font-size: 16px;
  }
}

/* -------- Alert Mobile -------- */
@media (max-width: 680px) {
  .alert {
    border-radius: 12px;
    padding: 12px 14px;
  }

  .alert-title {
    font-size: 14px;
  }

  .alert-text {
    font-size: 13px;
  }
}