/* ============================================================
   Docster · app.css · zuletzt 0.33.3 (Hardware-Zeilen einheitlich) · Basis 0.27.0
   ============================================================ */

/* ============ Klavika Font Face ============ */

@font-face {
  font-family: 'Klavika';
  src: url('/assets/fonts/KLAVIKA-LIGHT.OTF') format('opentype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Klavika';
  src: url('/assets/fonts/KLAVIKA-LIGHTITALIC.OTF') format('opentype');
  font-weight: 300;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Klavika';
  src: url('/assets/fonts/KLAVIKA-REGULAR.OTF') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Klavika';
  src: url('/assets/fonts/KLAVIKA-REGULARITALIC.OTF') format('opentype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Klavika';
  src: url('/assets/fonts/KLAVIKA-MEDIUM.OTF') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Klavika';
  src: url('/assets/fonts/KLAVIKA-MEDIUMITALIC.OTF') format('opentype');
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Klavika';
  src: url('/assets/fonts/KLAVIKA-BOLD.OTF') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Klavika';
  src: url('/assets/fonts/KLAVIKA-BOLDITALIC.OTF') format('opentype');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

:root {
  /* ============ Brand-Farben (Offertli-CI) ============ */
  --brand-blue:        #1a3a6b;
  --brand-blue-dark:   #0f1f3d;
  --brand-blue-light:  #2c5aa0;
  --brand-blue-soft:   #e8eef7;

  --brand-gold:        #d4a02a;
  --brand-gold-dark:   #b8861a;
  --brand-gold-light:  #f3dd95;
  --brand-gold-soft:   #faf3df;

  /* ============ Hintergründe ============ */
  --bg:                #f4f3ed;
  --bg-2:              #faf9f4;
  --paper:             #ffffff;

  /* ============ Text ============ */
  --ink:               #1a2236;
  --ink-2:             #455171;
  --ink-3:             #8893a8;
  --ink-4:             #c4cad7;

  /* ============ Linien ============ */
  --line:              #e4e2d8;
  --line-strong:       #c9c6b8;
  --line-blue:         #d1dbeb;

  /* ============ Sidebar ============ */
  --sidebar:           #0f1f3d;
  --sidebar-2:         #1a3050;
  --sidebar-text:      #c5cee0;
  --sidebar-text-dim:  #6b7894;

  /* ============ Status-Farben ============ */
  --green:             #5b8c3a;
  --green-soft:        #e8f3e0;
  --green-border:      #b8d49e;
  --amber:             #d4a02a;
  --amber-soft:        #faf3df;
  --amber-border:      #e8d196;
  --red:               #b53d3d;
  --red-soft:          #f7e3e3;
  --red-border:        #e5b7b7;
  --blue:              #2c5aa0;
  --blue-soft:         #e8eef7;
  --blue-border:       #b9c8e0;

  /* ============ Radien ============ */
  --r-sm: 5px;
  --r:    7px;
  --r-lg: 11px;

  /* ============ Schatten ============ */
  --shadow-1: 0 1px 2px rgba(15,31,61,0.06), 0 1px 3px rgba(15,31,61,0.03);
  --shadow-2: 0 2px 6px rgba(15,31,61,0.10), 0 1px 2px rgba(15,31,61,0.05);
  --shadow-card: 0 4px 12px rgba(15,31,61,0.08);

  /* ============ Gradients ============ */
  --grad-blue: linear-gradient(180deg, var(--brand-blue-light) 0%, var(--brand-blue) 100%);
  --grad-gold: linear-gradient(180deg, #e0b347 0%, var(--brand-gold) 100%);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: 'Klavika', 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--brand-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="search"], textarea, select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  transition: border-color 120ms, box-shadow 120ms;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(26,58,107,0.12);
}

.mono { font-family: 'Klavika', 'Inter', sans-serif; font-size: 12.5px; }
.num  { font-variant-numeric: tabular-nums; }
.right { text-align: right; }

/* ============================================================
   App Layout
   ============================================================ */

.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* ============================================================
   Sidebar (Offertli-Dunkelblau)
   ============================================================ */

.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-text);
  padding: 22px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #0a172d;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 6px 22px;
  border-bottom: 1px solid #1a3050;
  margin-bottom: 18px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  background: var(--grad-gold);
  color: var(--brand-blue-dark);
  display: grid;
  place-items: center;
  font-family: 'Klavika', 'Inter', sans-serif;
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(212,160,42,0.25);
}

.brand-name {
  font-family: 'Klavika', 'Inter', sans-serif;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: #ffffff;
  font-weight: 700;
  line-height: 1.1;
}
.brand-name span {
  display: block;
  color: var(--sidebar-text-dim);
  font-family: 'Klavika', 'Inter', sans-serif;
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 2px;
}

.nav-section { margin-bottom: 16px; }
.nav-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--sidebar-text-dim);
  padding: 0 10px 7px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--r-sm);
  color: var(--sidebar-text);
  font-size: 13px;
  cursor: pointer;
  transition: background 100ms, color 100ms;
  margin-bottom: 1px;
  text-decoration: none;
}
.nav-item:hover { background: var(--sidebar-2); color: #ffffff; text-decoration: none; }
.nav-item.active {
  background: var(--brand-gold);
  color: var(--brand-blue-dark);
  font-weight: 600;
}
.nav-item.active:hover { background: var(--brand-gold-dark); color: var(--brand-blue-dark); }
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Externer Link (z.B. Offertli) */
.nav-item-external {
  position: relative;
}
.nav-item-external span {
  flex: 1;
}
.nav-item-external .external-icon {
  width: 11px;
  height: 11px;
  opacity: 0.5;
  margin-left: auto;
}
.nav-item-external:hover .external-icon {
  opacity: 1;
}

.security-indicator {
  margin-top: auto;
  margin-bottom: 8px;
  padding: 10px 11px;
  background: rgba(212,160,42,0.08);
  border: 1px solid rgba(212,160,42,0.18);
  border-radius: var(--r-sm);
  font-size: 11px;
  color: var(--sidebar-text-dim);
  display: flex;
  align-items: center;
  gap: 9px;
}
.security-indicator svg { width: 14px; height: 14px; color: var(--brand-gold); flex-shrink: 0; }
.security-indicator strong { color: var(--brand-gold-light); font-weight: 600; display: block; margin-bottom: 1px; }

.sidebar-footer {
  border-top: 1px solid #1a3050;
  padding-top: 12px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
}
.user-chip .avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--grad-gold);
  color: var(--brand-blue-dark);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 11px;
}
.user-chip-info { flex: 1; min-width: 0; }
.user-chip-name {
  font-size: 12.5px;
  font-weight: 500;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-chip-role { font-size: 10.5px; color: var(--sidebar-text-dim); }

/* ============================================================
   Main
   ============================================================ */

.main {
  background: var(--bg);
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-3);
}
.breadcrumb a { color: var(--ink-2); }
.breadcrumb a:hover { color: var(--brand-blue); }
.breadcrumb .current { color: var(--brand-blue); font-weight: 600; }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  padding: 8px 12px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  width: 340px;
}
.search svg { width: 14px; height: 14px; color: var(--ink-3); }
.search input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 12.5px;
  width: 100%;
  padding: 0;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: var(--paper);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--ink-2);
  transition: all 120ms;
}
.icon-btn:hover { background: var(--brand-blue); color: white; border-color: var(--brand-blue); }
.icon-btn svg { width: 14px; height: 14px; }

/* ============================================================
   Flash Messages
   ============================================================ */

.flash-container {
  padding: 14px 28px 0;
}
.flash {
  padding: 11px 14px;
  border-radius: var(--r-sm);
  margin-bottom: 8px;
  font-size: 13px;
  border: 1px solid;
  display: flex;
  align-items: center;
  gap: 8px;
}
.flash-success { background: var(--green-soft); border-color: var(--green-border); color: #3c5826; }
.flash-error   { background: var(--red-soft);   border-color: var(--red-border);   color: #6c2222; }
.flash-info    { background: var(--blue-soft);  border-color: var(--blue-border);  color: var(--brand-blue); }
.flash-warning { background: var(--amber-soft); border-color: var(--amber-border); color: #6a4e1c; }

/* ============================================================
   Page Header / Content
   ============================================================ */

.page {
  padding: 24px 28px 60px;
  max-width: 1480px;
}

.page-header {
  margin-bottom: 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.page-title {
  font-family: 'Klavika', 'Inter', sans-serif;
  font-size: 32px;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--brand-blue);
  font-weight: 700;
}
.page-sub {
  font-size: 13px;
  color: var(--ink-3);
  margin-top: 4px;
}
.page-actions { display: flex; gap: 8px; }

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 120ms;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
  white-space: nowrap;
  line-height: 1;
}
.btn:hover { background: var(--bg-2); text-decoration: none; }
.btn svg { width: 13px; height: 13px; }

.btn-primary {
  background: var(--grad-blue);
  color: white;
  border-color: var(--brand-blue);
  box-shadow: 0 1px 2px rgba(15,31,61,0.15);
}
.btn-primary:hover {
  background: var(--brand-blue);
  border-color: var(--brand-blue-dark);
  color: white;
  box-shadow: 0 2px 4px rgba(15,31,61,0.25);
}

.btn-accent {
  background: var(--grad-gold);
  color: var(--brand-blue-dark);
  border-color: var(--brand-gold);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(212,160,42,0.25);
}
.btn-accent:hover {
  background: var(--brand-gold);
  border-color: var(--brand-gold-dark);
  color: var(--brand-blue-dark);
  box-shadow: 0 2px 4px rgba(212,160,42,0.35);
}

.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--paper); color: var(--brand-blue); border-color: var(--line); }

.btn-sm { padding: 6px 11px; font-size: 11.5px; }

.btn-danger {
  background: var(--red);
  color: white;
  border-color: var(--red);
}
.btn-danger:hover { background: #951f1f; color: white; }

/* ============================================================
   Cards
   ============================================================ */

.card {
  background: var(--paper);
  border-radius: var(--r);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}

.card-title {
  font-family: 'Klavika', 'Inter', sans-serif;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--brand-blue);
  font-weight: 700;
}

.card-body { padding: 18px; }

/* ============================================================
   Stats Grid
   ============================================================ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.stat {
  background: var(--paper);
  border-radius: var(--r);
  border: 1px solid var(--line);
  padding: 16px 18px;
  box-shadow: var(--shadow-1);
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--grad-blue);
  opacity: 0;
  transition: opacity 200ms;
}
.stat:hover::before { opacity: 1; }
.stat-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--ink-3);
  font-weight: 600;
  margin-bottom: 7px;
}
.stat-value {
  font-family: 'Klavika', 'Inter', sans-serif;
  font-size: 30px;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--brand-blue);
  font-weight: 700;
}
.stat-meta {
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--ink-3);
}

.delta { font-weight: 500; font-size: 11.5px; }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }

/* ============================================================
   Tables
   ============================================================ */

.table-wrap {
  background: var(--paper);
  border-radius: var(--r);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}

.table {
  width: 100%;
  border-collapse: collapse;
}
.table th {
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: white;
  font-weight: 600;
  padding: 11px 18px;
  background: var(--brand-blue);
  border-bottom: 1px solid var(--brand-blue-dark);
}
.table td {
  padding: 11px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  vertical-align: middle;
}
.table tbody tr {
  cursor: pointer;
  transition: background 80ms;
}
.table tbody tr:hover { background: var(--brand-blue-soft); }
.table tbody tr:last-child td { border-bottom: none; }

.customer-cell {
  display: flex;
  align-items: center;
  gap: 9px;
}
.customer-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  background: var(--brand-blue);
  color: white;
  display: grid;
  place-items: center;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-family: 'Klavika', 'Inter', sans-serif;
  flex-shrink: 0;
}

/* ============================================================
   Badges
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 600;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink-2);
}
.badge.red    { background: var(--red-soft);   color: #6c2222; border-color: var(--red-border); }
.badge.amber  { background: var(--amber-soft); color: #6a4e1c; border-color: var(--amber-border); }
.badge.green  { background: var(--green-soft); color: #3c5826; border-color: var(--green-border); }
.badge.blue   { background: var(--blue-soft);  color: var(--brand-blue); border-color: var(--blue-border); }
.badge.gold   { background: var(--brand-gold); color: var(--brand-blue-dark); border-color: var(--brand-gold-dark); }
.badge.badge-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.flag-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  background: var(--brand-gold);
  color: var(--brand-blue-dark);
  border-radius: 50px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--brand-gold-dark);
}
.flag-badge svg { width: 11px; height: 11px; }

.expiry-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.expiry-tag.soon  { background: var(--amber-soft); color: #6a4e1c; }
.expiry-tag.late  { background: var(--red-soft);   color: #6c2222; }

.year-pill {
  display: inline-block;
  padding: 2px 9px;
  background: var(--brand-gold);
  color: var(--brand-blue-dark);
  border-radius: 50px;
  font-size: 10.5px;
  font-weight: 700;
  margin-left: 8px;
  vertical-align: middle;
}

.checkmark {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
}
.checkmark svg { width: 11px; height: 11px; stroke-width: 3; }

/* ============================================================
   Dossier
   ============================================================ */

.dossier-header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
  padding: 18px 20px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-1);
}
.dossier-avatar {
  width: 60px;
  height: 60px;
  border-radius: var(--r);
  background: var(--brand-blue);
  color: white;
  display: grid;
  place-items: center;
  font-family: 'Klavika', 'Inter', sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.dossier-title {
  font-family: 'Klavika', 'Inter', sans-serif;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--brand-blue);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}
.dossier-meta {
  display: flex;
  gap: 14px;
  font-size: 12.5px;
  color: var(--ink-3);
  margin-top: 4px;
  flex-wrap: wrap;
}
.dossier-meta .mono { font-size: 11.5px; }
.dossier-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--line);
  margin-bottom: 18px;
  overflow-x: auto;
}
.tab {
  padding: 10px 16px;
  font-size: 12.5px;
  color: var(--ink-3);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}
.tab.active { color: var(--brand-blue); border-color: var(--brand-gold); }
.tab:hover:not(.active) { color: var(--brand-blue); }
.tab .count {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  background: var(--bg);
  border-radius: 50px;
  font-size: 10.5px;
  color: var(--ink-3);
  font-weight: 600;
}
.tab.active .count {
  background: var(--brand-blue);
  color: white;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.dossier-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
}

.kv-list { padding: 4px 0; }
.kv {
  display: grid;
  grid-template-columns: 150px 1fr 110px;
  gap: 14px;
  padding: 11px 18px;
  font-size: 13px;
  align-items: center;
  border-bottom: 1px solid var(--bg);
}
.kv:last-child { border-bottom: none; }
.kv-key { color: var(--ink-3); font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.kv-val { color: var(--ink); }
.kv-val.mono { font-size: 12.5px; }

.password-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--brand-blue-soft);
  padding: 4px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-blue);
  font-family: 'Klavika', 'Inter', sans-serif;
  font-size: 12.5px;
}
.password-field .pw-mask { letter-spacing: 0.15em; }

.notes-card {
  background: var(--brand-gold-soft);
  border: 1px solid var(--amber-border);
}
.notes-card .card-header {
  background: transparent;
  border-color: var(--amber-border);
}
.notes-card .card-title {
  color: #6a4e1c;
}
.note {
  padding: 14px 18px;
  font-size: 13px;
  line-height: 1.55;
  color: #5a4b1f;
}

/* ============================================================
   Toolbar
   ============================================================ */

.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.filter-chip {
  padding: 7px 13px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 50px;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}
.filter-chip:hover { background: var(--bg-2); color: var(--brand-blue); text-decoration: none; }
.filter-chip.active {
  background: var(--brand-blue);
  color: white;
  border-color: var(--brand-blue);
}
.filter-chip .count {
  background: rgba(255,255,255,0.2);
  padding: 1px 7px;
  border-radius: 50px;
  font-size: 10.5px;
  font-weight: 600;
}
.filter-chip:not(.active) .count {
  background: var(--bg);
  color: var(--ink-3);
}

/* ============================================================
   Forms
   ============================================================ */

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 12.5px;
  user-select: none;
}
.toggle-switch {
  width: 34px;
  height: 20px;
  background: var(--brand-blue);
  border-radius: 50px;
  position: relative;
  transition: background 160ms;
}
.toggle-switch::after {
  content: '';
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 16px;
  transition: left 160ms;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.toggle.off .toggle-switch { background: var(--ink-4); }
.toggle.off .toggle-switch::after { left: 2px; }

.form-split {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
}

/* ============================================================
   File Upload
   ============================================================ */

.file-upload {
  border: 2px dashed var(--line-strong);
  border-radius: var(--r);
  padding: 24px;
  text-align: center;
  background: var(--bg-2);
  transition: border-color 120ms, background 120ms;
}
.file-upload:hover {
  border-color: var(--brand-blue);
  background: var(--brand-blue-soft);
}

.file-list { display: flex; flex-direction: column; gap: 6px; }
.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.file-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  background: var(--paper);
  display: grid;
  place-items: center;
  font-size: 14px;
  border: 1px solid var(--line);
}
.file-name { font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: 11px; color: var(--ink-3); margin-top: 1px; }

/* ============================================================
   Modal
   ============================================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 31, 61, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-backdrop.active { display: flex; }

.modal {
  background: var(--paper);
  border-radius: var(--r);
  border: 1px solid var(--line);
  box-shadow: 0 12px 40px rgba(15,31,61,0.25);
  width: 560px;
  max-width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--brand-blue-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-title {
  font-family: 'Klavika', 'Inter', sans-serif;
  font-size: 20px;
  color: var(--brand-blue);
  font-weight: 700;
}
.modal-body { padding: 20px; }
.modal-footer {
  padding: 13px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: var(--bg-2);
}

.column-builder {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.column-builder-row {
  display: grid;
  grid-template-columns: 1fr 180px 32px;
  gap: 6px;
  align-items: center;
}
.column-builder-add {
  margin-top: 8px;
  padding: 8px 12px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-sm);
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  font-weight: 500;
}
.column-builder-add:hover { border-color: var(--brand-blue); color: var(--brand-blue); background: var(--brand-blue-soft); }

/* ============================================================
   Login (Offertli-Stil mit dunklem Hintergrund)
   ============================================================ */

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--sidebar);
  padding: 20px;
  position: relative;
}
.login-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(212,160,42,0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(44,90,160,0.15) 0%, transparent 50%);
  pointer-events: none;
}
.login-card {
  background: var(--paper);
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  padding: 40px;
  width: 420px;
  max-width: 100%;
  position: relative;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
}
.login-brand-name {
  font-family: 'Klavika', 'Inter', sans-serif;
  font-size: 28px;
  letter-spacing: -0.02em;
  color: var(--brand-blue);
  font-weight: 700;
  line-height: 1.1;
}
.login-brand-name span {
  display: block;
  color: var(--ink-3);
  font-family: 'Klavika', 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 1px;
}

.login-title {
  font-family: 'Klavika', 'Inter', sans-serif;
  font-size: 24px;
  color: var(--brand-blue);
  margin-bottom: 4px;
  font-weight: 700;
}
.login-sub {
  font-size: 13px;
  color: var(--ink-3);
  margin-bottom: 24px;
}

.login-field { margin-bottom: 14px; }
.login-field label {
  display: block;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--ink-3);
  margin-bottom: 6px;
  font-weight: 600;
}

.login-actions {
  display: flex;
  gap: 8px;
  margin-top: 22px;
}

.login-security {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-3);
  text-align: center;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}
.login-security svg { width: 12px; height: 12px; color: var(--brand-gold); }

.twofa-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
  margin-bottom: 8px;
}
.twofa-digit {
  width: 100%;
  height: 54px;
  text-align: center;
  font-size: 22px;
  font-family: 'Klavika', 'Inter', sans-serif;
  font-weight: 700;
  border: 2px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 0;
  color: var(--brand-blue);
}
.twofa-digit:focus {
  border-color: var(--brand-blue);
  outline: none;
  background: var(--brand-blue-soft);
  box-shadow: 0 0 0 3px rgba(26,58,107,0.10);
}

/* ============================================================
   Backup Flag Widget
   ============================================================ */

.backup-flag-card {
  background: linear-gradient(135deg, var(--brand-gold-soft) 0%, var(--paper) 70%);
  border-color: var(--amber-border);
}
.backup-flag-row {
  display: grid;
  grid-template-columns: 28px 1fr auto auto auto;
  gap: 12px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--amber-border);
  align-items: center;
}
.backup-flag-row:last-child { border-bottom: none; }
.flag-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--amber-soft);
  color: var(--brand-gold-dark);
}
.flag-icon.overdue { background: var(--red-soft); color: var(--red); }
.flag-icon.ok { background: var(--green-soft); color: var(--green); }
.flag-icon svg { width: 12px; height: 12px; }
.flag-customer { font-weight: 600; font-size: 13px; color: var(--brand-blue); }
.flag-meta { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.flag-last-check {
  font-size: 11.5px;
  color: var(--ink-3);
  font-family: 'Klavika', 'Inter', sans-serif;
  text-align: right;
}
.flag-actions { display: flex; gap: 4px; }

/* ============================================================
   Infrastructure Sections
   ============================================================ */

.infra-section {
  background: var(--paper);
  border-radius: var(--r);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  margin-bottom: 14px;
  overflow: hidden;
}
.infra-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.infra-section-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  background: var(--brand-blue-soft);
  border: 1px solid var(--line-blue);
  display: grid;
  place-items: center;
  font-size: 18px;
}
.infra-section-title {
  font-family: 'Klavika', 'Inter', sans-serif;
  font-size: 18px;
  color: var(--brand-blue);
  font-weight: 700;
}
.infra-section-meta { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }

.add-section-card {
  background: var(--paper);
  border: 2px dashed var(--line-strong);
  border-radius: var(--r);
  padding: 26px;
  text-align: center;
  cursor: pointer;
  transition: border-color 120ms, background 120ms;
  margin-top: 14px;
}
.add-section-card:hover { border-color: var(--brand-blue); background: var(--brand-blue-soft); }
.add-section-card svg { width: 24px; height: 24px; color: var(--brand-blue); margin-bottom: 8px; }
.add-section-card-title { font-weight: 600; font-size: 13px; color: var(--brand-blue); }
.add-section-card-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }

/* ============================================================
   Alerts & Activity
   ============================================================ */

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 18px;
}

.alert-list, .activity-list {
  padding: 4px 0;
}
.alert-row, .activity-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  padding: 10px 18px;
  align-items: center;
  border-bottom: 1px solid var(--bg);
  cursor: pointer;
}
.alert-row:hover, .activity-item:hover { background: var(--brand-blue-soft); }
.alert-row:last-child, .activity-item:last-child { border-bottom: none; }

.alert-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--amber);
}
.alert-dot.red { background: var(--red); }
.alert-customer { font-size: 13px; font-weight: 600; color: var(--brand-blue); }
.alert-msg { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }

.activity-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  display: grid;
  place-items: center;
}
.activity-icon svg { width: 11px; height: 11px; stroke-width: 3; }
.activity-text { font-size: 12.5px; }
.activity-time { font-size: 11px; color: var(--ink-3); margin-top: 1px; font-family: 'Klavika', 'Inter', sans-serif; }

/* ============================================================
   Maintenance / Wartung (Offertli-Stil)
   ============================================================ */

.maintenance-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.maintenance-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: var(--brand-blue);
  border: 1px solid var(--brand-blue-dark);
  border-radius: var(--r);
  color: white;
  text-decoration: none;
  transition: all 120ms;
  box-shadow: var(--shadow-1);
}
.maintenance-card:hover {
  background: var(--brand-blue-dark);
  border-color: var(--brand-gold);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
}
.maintenance-card-wide {
  grid-column: 1 / -1;
}

.maintenance-card-body { min-width: 0; }
.maintenance-card-title {
  font-family: 'Klavika', 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand-gold-light);
  margin-bottom: 8px;
}
.maintenance-card-desc {
  font-size: 13px;
  color: #c5cee0;
  line-height: 1.5;
}
.maintenance-card-badge {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.maintenance-card-action {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand-gold);
  white-space: nowrap;
  align-self: center;
}

code.mono, .mono code {
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--line);
  font-size: 11.5px;
}

/* ============================================================
   Map Card (Leaflet / OpenStreetMap)
   ============================================================ */

.map-frame {
  position: relative;
  width: 100%;
  height: 220px;
  background: var(--bg-2);
  overflow: hidden;
  cursor: grab;
}
.map-frame:active { cursor: grabbing; }

.map-frame-missing {
  display: grid;
  place-items: center;
  cursor: default;
}

/* Leaflet override: keine eckigen Standard-Schatten, Klavika-Font */
.map-frame .leaflet-control-attribution {
  font-family: 'Klavika', 'Inter', sans-serif;
  font-size: 10px;
  background: rgba(255,255,255,0.85);
  padding: 1px 6px;
  color: var(--ink-3);
}
.map-frame .leaflet-control-attribution a {
  color: var(--brand-blue);
}
.map-frame .leaflet-control-zoom a {
  font-family: 'Klavika', 'Inter', sans-serif;
  color: var(--brand-blue);
  background: var(--paper);
  border-color: var(--line);
}
.map-frame .leaflet-control-zoom a:hover {
  background: var(--brand-blue-soft);
  color: var(--brand-blue);
}
.map-frame .leaflet-popup-content-wrapper {
  border-radius: var(--r-sm);
  background: var(--brand-blue);
  color: white;
  font-family: 'Klavika', 'Inter', sans-serif;
  box-shadow: 0 2px 12px rgba(15,31,61,0.25);
}
.map-frame .leaflet-popup-content {
  font-size: 12.5px;
  font-weight: 500;
  margin: 8px 12px;
}
.map-frame .leaflet-popup-tip {
  background: var(--brand-blue);
}
.map-frame .leaflet-popup-close-button {
  color: rgba(255,255,255,0.7) !important;
}

/* Custom Docster-Marker (Gold-Pin im Offertli-Stil) */
.docster-marker {
  position: relative;
}
.docster-marker .marker-pin {
  position: absolute;
  width: 30px;
  height: 30px;
  border-radius: 50% 50% 50% 0;
  background: var(--brand-gold);
  border: 2px solid var(--brand-blue-dark);
  transform: rotate(-45deg);
  left: 0;
  top: 0;
  box-shadow: 0 2px 6px rgba(15,31,61,0.4);
}
.docster-marker .marker-dot {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--brand-blue-dark);
  border-radius: 50%;
  left: 10px;
  top: 10px;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .dashboard-grid, .form-split, .dossier-grid { grid-template-columns: 1fr; }
  .search { width: 200px; }
  .backup-flag-row { grid-template-columns: 24px 1fr auto; }
  .flag-last-check, .flag-actions { display: none; }
  .page { padding: 16px; }
  .maintenance-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Build 0.9.0 · Docs-Layout & Markdown
============================================================ */

.docs-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 22px;
  align-items: start;
}

.docs-sidebar {
  position: sticky;
  top: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

.docs-sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}

.docs-sidebar-title {
  font-weight: 600;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-2);
}

.docs-search {
  margin-bottom: 8px;
}
.docs-search input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 12.5px;
  font-family: inherit;
}
.docs-search input:focus {
  outline: none;
  border-color: var(--brand-blue);
}

.docs-tree {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.tree-node {}

.tree-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 12.5px;
  color: var(--ink-1);
  text-decoration: none;
  line-height: 1.3;
}
.tree-link:hover { background: var(--bg-2); }
.tree-link.active {
  background: var(--brand-blue);
  color: #fff;
  font-weight: 500;
}
.tree-link.active .tree-count { background: rgba(255,255,255,0.25); color: #fff; }

.tree-icon { flex-shrink: 0; font-size: 13px; }
.tree-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-count {
  flex-shrink: 0;
  font-size: 10.5px;
  background: var(--bg-2);
  color: var(--ink-3);
  padding: 1px 6px;
  border-radius: 8px;
  font-family: var(--font-mono);
}

.docs-main {
  min-width: 0;
}

.doc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  transition: background 100ms;
}
.doc-row:hover { background: var(--bg-2); }
.doc-row:last-child { border-bottom: none; }

.doc-row-title {
  font-weight: 500;
  font-size: 13.5px;
  margin-bottom: 2px;
}
.doc-row-meta {
  font-size: 11px;
  color: var(--ink-3);
}

.search-result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}
.search-result-row:hover { background: var(--bg-2); }
.search-result-row:last-child { border-bottom: none; }
.search-result-title { font-weight: 500; font-size: 13.5px; margin-bottom: 2px; }
.search-result-meta { font-size: 11px; color: var(--ink-3); }

.empty-customer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  font-size: 13px;
}
.empty-customer-row:hover { background: var(--bg-2); }
.empty-customer-row:last-child { border-bottom: none; }

/* Markdown-Editor */
.docs-edit-form {}
.md-editor-wrap {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}
.md-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.md-btn {
  background: transparent;
  border: 1px solid transparent;
  padding: 4px 8px;
  font-size: 12.5px;
  cursor: pointer;
  border-radius: 3px;
  font-family: inherit;
  color: var(--ink-1);
  line-height: 1.2;
}
.md-btn:hover { background: #fff; border-color: var(--line); }
.md-sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }
.md-editor-body {}
.md-editor-body textarea {
  width: 100%;
  min-height: 480px;
  border: none;
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  background: #fff;
}
.md-editor-body textarea:focus { outline: none; }
.md-preview { padding: 24px 28px; min-height: 480px; background: #fff; }

/* Markdown-Rendering */
.md-content { font-size: 14px; line-height: 1.7; color: var(--ink-1); }
.md-content h1, .md-content h2, .md-content h3, .md-content h4, .md-content h5, .md-content h6 {
  margin: 1.5em 0 0.5em;
  line-height: 1.3;
  color: var(--brand-blue);
  font-weight: 600;
}
.md-content h1 { font-size: 24px; border-bottom: 2px solid var(--line); padding-bottom: 6px; }
.md-content h2 { font-size: 20px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.md-content h3 { font-size: 17px; }
.md-content h4 { font-size: 15px; }
.md-content p { margin: 0.7em 0; }
.md-content ul, .md-content ol { margin: 0.5em 0; padding-left: 24px; }
.md-content li { margin: 0.2em 0; }
.md-content a { color: var(--brand-blue); text-decoration: underline; }
.md-content strong { color: var(--ink-1); font-weight: 600; }
.md-inline-code {
  background: var(--bg-2);
  padding: 1px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--brand-gold-dark);
}
.md-code {
  background: #1a3a6b;
  color: #f0f0f0;
  padding: 14px 16px;
  border-radius: 6px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  margin: 1em 0;
}
.md-code code { background: transparent; color: inherit; padding: 0; }

@media (max-width: 900px) {
  .docs-layout { grid-template-columns: 1fr; }
  .docs-sidebar { position: static; max-height: none; }
}

/* Trust-Device-Checkbox auf 2FA-Seite */
.twofa-trust {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 14px 0;
  padding: 10px 12px;
  background: var(--bg-2);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12.5px;
  line-height: 1.5;
  user-select: none;
}
.twofa-trust input[type="checkbox"] {
  margin-top: 2px;
  cursor: pointer;
}
.twofa-trust small {
  display: block;
  color: var(--ink-3);
  font-size: 11px;
  margin-top: 1px;
}

/* ============================================================
   Build 0.12.0 · Schrift +15% global + Bild-Upload in Editor
============================================================ */

/* Schrift-Boost: alle expliziten px-Werte um ~15% anheben
   (Faktor 1.15, gerundet auf 0.5 px) */

/* Sidebar */
.sidebar-section-title { font-size: 11.5px !important; }
.nav-item { font-size: 14.5px !important; }
.user-chip-name { font-size: 14px !important; }
.user-chip-role { font-size: 12px !important; }
.brand-name { font-size: 17px !important; }
.brand-sub { font-size: 11.5px !important; }
.security-indicator { font-size: 11.5px !important; }

/* Topbar / Breadcrumb */
.breadcrumb { font-size: 13px !important; }
.search-mini input { font-size: 13.5px !important; }

/* Cards / Tabellen */
.card-title { font-size: 16px !important; }
.card-header .card-subtitle { font-size: 12.5px !important; }
.table { font-size: 14px !important; }
.table th { font-size: 12px !important; }
.table td { font-size: 14px !important; }
.kv-key { font-size: 12.5px !important; }
.kv-val { font-size: 14px !important; }

/* Buttons */
.btn { font-size: 13.5px !important; }
.btn-sm { font-size: 13px !important; }

/* Stats */
.stat-label { font-size: 12px !important; }
.stat-value { font-size: 28px !important; }
.stat-meta { font-size: 13px !important; }
.delta { font-size: 13px !important; }

/* Page-Header */
.page-title { font-size: 26px !important; }
.page-sub { font-size: 14px !important; }

/* Form Fields */
.form-field label { font-size: 12.5px !important; }
.form-field input, .form-field select, .form-field textarea { font-size: 14.5px !important; }

/* Badges */
.badge { font-size: 11.5px !important; }

/* Flash */
.flash { font-size: 13.5px !important; }

/* Tree (Anleitungen-Sidebar) */
.tree-link { font-size: 14px !important; }
.tree-count { font-size: 12px !important; }
.docs-sidebar-title { font-size: 14px !important; }

/* Markdown-Content (Anleitungs-Anzeige) wird etwas grösser für Lesbarkeit */
.md-content { font-size: 16px !important; line-height: 1.7 !important; }
.md-content h1 { font-size: 28px !important; }
.md-content h2 { font-size: 23px !important; }
.md-content h3 { font-size: 19.5px !important; }
.md-content h4 { font-size: 17px !important; }
.md-inline-code { font-size: 14.5px !important; }
.md-code { font-size: 14px !important; }

/* Markdown-Editor */
.md-editor-body textarea { font-size: 15px !important; line-height: 1.65 !important; }
.md-btn { font-size: 14.5px !important; }

/* Modal */
.modal-title { font-size: 17px !important; }

/* ============================================================
   Bild-Upload-Editor-Komponenten
============================================================ */

.md-paste-hint {
  font-size: 11.5px;
  color: var(--ink-3);
  margin: 0 8px;
  font-style: italic;
  white-space: nowrap;
}
@media (max-width: 1100px) {
  .md-paste-hint { display: none; }
}

.md-upload-progress {
  padding: 10px 14px;
  background: var(--brand-gold-soft);
  border-bottom: 1px solid var(--line);
}
.md-upload-progress-text {
  font-size: 12.5px;
  color: var(--brand-gold-dark);
  margin-bottom: 5px;
  font-weight: 500;
}
.md-upload-progress-bar {
  height: 4px;
  background: var(--bg-2);
  border-radius: 2px;
  overflow: hidden;
}
.md-upload-progress-fill {
  height: 100%;
  background: var(--brand-gold);
  width: 0%;
  transition: width 200ms ease-out;
}

.md-editor-body textarea.md-dragover {
  background: var(--brand-gold-soft) !important;
  outline: 2px dashed var(--brand-gold);
  outline-offset: -8px;
}

.md-image {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 12px 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  display: block;
}

/* ============================================================
   Build 0.15.0 · Backup-Kontroll-Status
============================================================ */

.backup-status-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-radius: 8px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
}
.backup-status-banner.status-banner-ok        { background: #e8f5ec; border-color: #2c8745; }
.backup-status-banner.status-banner-warn      { background: #fdf6e0; border-color: #d4a02a; }
.backup-status-banner.status-banner-overdue,
.backup-status-banner.status-banner-never     { background: #fbe9e9; border-color: #c43838; }
.backup-status-banner.status-banner-no_config { background: var(--bg-2); border-color: var(--line); }

/* ============================================================
   Build 0.27.0 · Mobile-Vollüberarbeitung
============================================================ */

html[data-theme="dark"] {
  --bg:                #14171f;
  --bg-2:              #1c2029;
  --paper:             #20242f;

  --ink:               #e4e7ee;
  --ink-2:             #b4bccc;
  --ink-3:             #7d8493;
  --ink-4:             #4a505d;

  --line:              #2c313d;
  --line-strong:       #3a4051;
  --line-blue:         #2a3550;

  --sidebar:           #0a1020;
  --sidebar-2:         #131a2e;
  --sidebar-text:      #c5cee0;
  --sidebar-text-dim:  #6b7894;

  --brand-blue-soft:   #1c2c47;
  --brand-gold-soft:   #2a2418;

  --green-soft:        #1f2e1e;
  --green-border:      #3d5d36;
  --amber-soft:        #2a2418;
  --amber-border:      #4d3f1c;
  --red-soft:          #2e1d1d;
  --red-border:        #5d3636;
  --blue-soft:         #1c2c47;
  --blue-border:       #2c4570;

  --shadow-1: 0 1px 2px rgba(0,0,0,0.4), 0 1px 3px rgba(0,0,0,0.2);
  --shadow-2: 0 2px 6px rgba(0,0,0,0.5), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-card: 0 4px 12px rgba(0,0,0,0.5);
}

/* Dark Mode: Status-Banner heller machen */
html[data-theme="dark"] .backup-status-banner.status-banner-ok        { background: #1f2e1e; }
html[data-theme="dark"] .backup-status-banner.status-banner-warn      { background: #2a2418; }
html[data-theme="dark"] .backup-status-banner.status-banner-overdue,
html[data-theme="dark"] .backup-status-banner.status-banner-never     { background: #2e1d1d; }

/* Inputs/Forms im Dark Mode */
html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
  background: var(--bg-2);
  color: var(--ink);
  border-color: var(--line-strong);
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: var(--ink-3);
}

/* Tabellen-Header im Dark Mode */
html[data-theme="dark"] .table thead th {
  background: var(--bg-2);
}

/* Theme-Toggle Button */
.theme-toggle-form {
  display: inline-flex;
  margin-left: 12px;
}
.theme-toggle {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.15s;
}
.theme-toggle:hover {
  background: var(--bg-2);
  color: var(--ink);
  border-color: var(--line-strong);
}
.theme-toggle svg { width: 16px; height: 16px; }

/* ============ Mobile-Nav-Toggle ============ */
.mobile-nav-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 100;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-1);
}
.mobile-nav-toggle svg { width: 20px; height: 20px; color: var(--ink); }

.mobile-nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 31, 61, 0.6);
  z-index: 80;
}

/* ============ Mobile-Layout ============ */
@media (max-width: 900px) {
  .mobile-nav-toggle { display: inline-flex; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 90;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow-2);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .mobile-nav-backdrop { display: block; }

  .main {
    margin-left: 0 !important;
    padding: 64px 14px 24px;
  }

  .topbar {
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 0 14px;
  }
  .topbar .breadcrumb { order: 1; flex: 1 1 100%; padding-left: 50px; min-height: 28px; }
  .topbar .search { order: 2; flex: 1 1 auto; min-width: 0; }
  .topbar .theme-toggle-form { order: 3; margin-left: 0; }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .page-actions { width: 100%; flex-wrap: wrap; }

  /* Stat-Cards stapeln */
  .stats-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px;
  }
  .stat { padding: 12px 14px; }
  .stat-value { font-size: 22px; }

  /* Dashboard-Grid einspaltig */
  .dashboard-grid {
    grid-template-columns: 1fr !important;
  }

  /* Tabellen horizontal scrollbar */
  .card { overflow-x: auto; }
  .table { min-width: 520px; }

  /* Cards weniger padding */
  .card .card-header { padding: 12px 14px; }

  /* Tabs scrollbar machen */
  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    flex-wrap: nowrap;
  }
  .tab { flex-shrink: 0; }

  /* Modals fullscreen */
  .modal { width: calc(100vw - 24px) !important; max-width: none !important; max-height: 90vh; overflow-y: auto; }

  /* Form-Grid einspaltig */
  .form-grid { grid-template-columns: 1fr !important; }

  /* Year-Nav scrollbar */
  .year-nav { flex-wrap: wrap; }

  /* Filter-Pills auf neuer Zeile */
  .toolbar, .filter-pills {
    flex-wrap: wrap;
  }
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr !important; }
  .stat-value { font-size: 26px; }
}

/* ============================================================
   Build 0.23.0 · Mobile-Optimierung (umfassend)
   Phone first: 320 - 480px sauber, 480-768 angepasst,
   768-900 als kleines Desktop
============================================================ */

/* ============ Touch-Targets vergroessern ============ */
@media (pointer: coarse), (max-width: 900px) {
  .btn {
    min-height: 40px;
    padding: 10px 14px;
  }
  .btn-sm {
    min-height: 34px;
    padding: 8px 12px;
  }
  .icon-btn {
    min-width: 36px;
    min-height: 36px;
  }
  input[type="text"], input[type="email"], input[type="password"],
  input[type="number"], input[type="date"], input[type="time"],
  input[type="search"], select, textarea {
    font-size: 16px !important; /* verhindert iOS-Auto-Zoom */
    min-height: 40px;
    padding: 9px 12px;
  }
  textarea { min-height: 60px; }
  .check-row input[type="checkbox"], input[type="checkbox"] {
    min-width: 18px;
    min-height: 18px;
    transform: scale(1.15);
  }
}

/* ============ Body-Scroll-Lock bei offener Sidebar/Modal ============ */
body.nav-open,
body.modal-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

/* ============ Mobile-Hauptlayout 0-900px ============ */
@media (max-width: 900px) {

  /* Topbar kompakt + Hamburger sauber */
  .topbar {
    padding: 8px 12px;
    gap: 8px;
    min-height: 56px;
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--paper);
  }
  .topbar .breadcrumb {
    order: 1;
    flex: 1 1 100%;
    padding-left: 48px;
    font-size: 11.5px;
    min-height: 22px;
    line-height: 22px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar .breadcrumb a, .topbar .breadcrumb span {
    display: inline;
  }
  .topbar .search {
    order: 2;
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
  }
  .topbar .search input { font-size: 14px !important; }
  .topbar .theme-toggle-form { order: 3; margin-left: 0; }

  .mobile-nav-toggle {
    top: 8px;
    left: 8px;
    width: 40px;
    height: 40px;
    background: var(--paper);
    border: 1px solid var(--line);
  }

  /* Sidebar als Off-Canvas + Width-Cap */
  .sidebar {
    width: min(80vw, 320px);
    max-width: 320px;
  }

  /* Main-Content */
  .main {
    margin-left: 0 !important;
    padding: 60px 12px 24px;
  }

  /* Page-Header umbruch */
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 14px;
  }
  .page-title { font-size: 20px !important; }
  .page-sub { font-size: 12px; }
  .page-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
  }
  .page-actions .btn { flex: 1 1 auto; justify-content: center; }
  .page-actions .btn-primary { flex: 1 1 100%; }

  /* Stat-Cards 2-spaltig */
  .stats-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }
  .stat {
    padding: 12px 14px !important;
  }
  .stat-label { font-size: 10.5px !important; }
  .stat-value { font-size: 22px !important; line-height: 1.1; }
  .stat-sub { font-size: 11px !important; }

  /* Dashboard-Grid einspaltig */
  .dashboard-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  /* Cards */
  .card { border-radius: 8px; }
  .card .card-header {
    padding: 12px 14px !important;
    flex-wrap: wrap;
    gap: 6px;
  }
  .card-title { font-size: 13.5px !important; }

  /* KV-Listen einspaltig */
  .kv {
    grid-template-columns: 1fr !important;
    gap: 2px 0 !important;
    padding: 10px 0 !important;
    border-bottom: 1px solid var(--line);
  }
  .kv:last-child { border-bottom: none; }
  .kv-key {
    font-size: 11px !important;
    color: var(--ink-3) !important;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  .kv-val { font-size: 14px !important; word-break: break-word; }

  /* Form-Layout */
  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .form-field label {
    font-size: 11.5px;
  }

  /* Tabs */
  .tabs {
    margin: 0 -12px 16px;
    padding: 0 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab {
    padding: 10px 14px !important;
    font-size: 12.5px !important;
    flex-shrink: 0;
  }
  .tab .count {
    font-size: 10.5px !important;
    margin-left: 4px;
  }

  /* Modals fullscreen-artig */
  .modal-backdrop.active {
    align-items: flex-end !important;
    padding: 0 !important;
  }
  .modal {
    width: 100vw !important;
    max-width: none !important;
    max-height: 92vh !important;
    overflow-y: auto;
    border-radius: 14px 14px 0 0 !important;
    margin: 0 !important;
  }
  .modal-header {
    position: sticky;
    top: 0;
    background: var(--paper);
    z-index: 2;
    padding: 14px 16px !important;
  }
  .modal-body { padding: 14px 16px !important; }
  .modal-footer {
    position: sticky;
    bottom: 0;
    background: var(--paper);
    border-top: 1px solid var(--line);
    padding: 12px 16px !important;
    display: flex;
    gap: 8px;
  }
  .modal-footer .btn { flex: 1 1 auto; justify-content: center; }

  /* Filter-Toolbar (Pills) */
  .toolbar, .filter-pills {
    margin: 0 -12px 14px;
    padding: 10px 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    white-space: nowrap;
    flex-wrap: nowrap;
    display: flex;
    gap: 6px;
  }
  .toolbar::-webkit-scrollbar, .filter-pills::-webkit-scrollbar { display: none; }
  .filter-chip {
    flex-shrink: 0;
    padding: 8px 12px !important;
    font-size: 12px !important;
  }

  /* Year-Navigation horizontal scrollbar */
  .year-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    scrollbar-width: none;
    margin: 0 -12px 14px;
    padding: 8px 12px;
  }
  .year-nav::-webkit-scrollbar { display: none; }

  /* Flash-Container */
  .flash-container { margin: 0 -12px 14px; padding: 0 12px; }
  .flash { font-size: 13px; padding: 10px 14px; }

  /* Tabellen werden zu Cards (responsive) ----------- */
  .table-mobile-cards {
    display: block;
  }
  .table-mobile-cards thead { display: none; }
  .table-mobile-cards tbody, .table-mobile-cards tr, .table-mobile-cards td {
    display: block;
    width: 100%;
  }
  .table-mobile-cards tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    background: var(--paper);
  }
  .table-mobile-cards tr:hover { background: var(--paper); }
  .table-mobile-cards td {
    padding: 4px 0;
    border: none;
  }
  .table-mobile-cards td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 10.5px;
    color: var(--ink-3);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
  }

  /* Normale Tabellen: horizontaler Scroll mit Schatten-Hinweis */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -12px;
    padding: 0 12px;
  }
  .table-wrap .table { min-width: 480px; }
  .table th, .table td {
    padding: 8px 10px !important;
    font-size: 12px !important;
  }
  .table th {
    font-size: 10.5px !important;
    white-space: nowrap;
  }

  /* Card-Inhalt voll nutzen */
  .card .card-body { padding: 14px !important; }

  /* Customer-Avatar etwas kompakter */
  .customer-avatar { width: 32px; height: 32px; font-size: 11px; }

  /* Status-Badges */
  .badge { font-size: 10.5px !important; padding: 3px 7px !important; }

  /* Maps + Diagramme */
  .map, #map, .leaflet-container { min-height: 280px; max-height: 60vh; }

  /* Long Texte */
  .mono { word-break: break-all; }
  table .mono { word-break: keep-all; }

  /* Sidebar-Backdrop höher als Sidebar nicht, aber tap-fail-safe */
  .mobile-nav-backdrop {
    z-index: 89;
    backdrop-filter: blur(2px);
  }

  /* Hours-Tabelle: speziell wegen Edit-Inputs */
  .hours-table { min-width: 540px; }
  .hours-table input.hours-input {
    width: 60px !important;
    font-size: 14px !important;
  }
  .hours-table input.hours-input.note {
    width: 100% !important;
    min-width: 120px;
  }

  /* Timeline (Dossier) */
  .timeline { padding-left: 24px !important; }
  .timeline-icon { left: -24px !important; width: 20px !important; height: 20px !important; font-size: 10px !important; }

  /* Status-Banner */
  .backup-status-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 10px 12px;
  }

  /* CSV/Renewal/Dossier-Buttons in Listen */
  .page-actions a.btn { font-size: 12.5px; padding: 9px 12px; }

  /* Customer-Show: 2 Spalten Avatar + Name werden besser stapelt */
  .customer-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .customer-header .customer-avatar { width: 48px; height: 48px; font-size: 14px; }
  .customer-header h1 { font-size: 20px !important; }
  .dossier-actions { width: 100%; }
  .dossier-actions .btn { flex: 1 1 auto; justify-content: center; }
}

/* ============ Sehr klein 0-480px ============ */
@media (max-width: 480px) {

  body { font-size: 14px; }

  /* Stat-Cards einspaltig auf sehr kleinen Phones */
  .stats-grid {
    grid-template-columns: 1fr !important;
  }
  .stat-value { font-size: 24px !important; }

  /* Page-Actions stacken untereinander */
  .page-actions {
    flex-direction: column;
  }
  .page-actions .btn {
    width: 100%;
  }

  /* Padding noch kleiner */
  .main { padding: 56px 10px 20px; }

  /* Avatar im Header der Kundenliste */
  .customer-avatar { width: 30px; height: 30px; font-size: 10.5px; }

  /* Header h1 noch kleiner */
  .page-title { font-size: 18px !important; }

  /* Tabs mit weniger Padding */
  .tab { padding: 8px 10px !important; font-size: 12px !important; }
}

/* ============ Querformat-Phones: Modal-Höhe anpassen ============ */
@media (max-width: 900px) and (orientation: landscape) {
  .modal { max-height: 100vh !important; border-radius: 0 !important; }
  .modal-backdrop.active { align-items: stretch !important; }
}

/* ============ Print: alles ausblenden was nicht ins PDF gehoert ============ */
@media print {
  .sidebar, .topbar, .mobile-nav-toggle, .mobile-nav-backdrop,
  .page-actions, .modal-backdrop, .theme-toggle-form,
  .flash-container, .tabs { display: none !important; }
  .main { margin-left: 0 !important; padding: 0 !important; }
  body { background: #fff !important; color: #000 !important; }
}

/* ============ Dossier-Header (Customer-Show) Mobile ============ */
@media (max-width: 900px) {
  .dossier-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 12px !important;
    padding: 14px !important;
  }
  .dossier-avatar {
    width: 48px !important;
    height: 48px !important;
    font-size: 14px !important;
  }
  .dossier-title {
    font-size: 18px !important;
    flex-wrap: wrap;
    gap: 8px;
  }
  .dossier-meta {
    flex-direction: column;
    gap: 4px !important;
    align-items: flex-start !important;
    font-size: 12px !important;
  }
  .dossier-meta span {
    display: inline-flex;
    align-items: center;
  }
  .dossier-actions {
    width: 100%;
    display: flex;
    gap: 8px;
  }
  .dossier-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
    text-align: center;
  }
}

/* ============ Infra-Kategorie-Reorder-Buttons ============ */
.infra-reorder-controls .icon-btn {
  font-size: 9px;
  color: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-2);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.infra-reorder-controls .icon-btn:hover:not(:disabled) {
  background: var(--brand-blue);
  color: #fff;
  border-color: var(--brand-blue);
}
.infra-reorder-controls .icon-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}
@media (max-width: 900px) {
  .infra-reorder-controls .icon-btn {
    width: 32px !important;
    height: 28px !important;
    min-height: 28px !important;
    font-size: 11px;
  }
}

/* ============ Editor-Hint (Build 0.24.0 · Editor ueberall) ============ */
.md-editor-hint {
  font-size: 11px;
  color: var(--ink-3);
  padding: 6px 10px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 6px 6px;
}
.md-editor-hint strong { color: var(--ink-2); font-weight: 600; }

/* Editor in Modals etwas kompakter */
.modal .md-editor-wrap { margin-bottom: 4px; }
.modal .md-editor-toolbar { flex-wrap: wrap; }
@media (max-width: 900px) {
  .md-editor-toolbar { flex-wrap: wrap; gap: 2px; }
  .md-btn { padding: 8px 10px !important; font-size: 13px; }
  .md-editor-hint { font-size: 10.5px; }
}

/* ============================================================
   Build 0.25.0 · Kunden-Übersicht Status-Cockpit
============================================================ */

/* Banner "alles gut" */
.status-cockpit-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-radius: 10px;
  margin-bottom: 18px;
}
.cockpit-ok {
  background: color-mix(in srgb, var(--green, #2c8745) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--green, #2c8745) 30%, transparent);
}
.cockpit-ok .cockpit-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--green, #2c8745);
  color: #fff;
  display: grid; place-items: center;
  font-size: 20px; font-weight: 700;
  flex-shrink: 0;
}
.cockpit-title { font-size: 15px; font-weight: 600; color: var(--ink-1); }
.cockpit-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }

/* Warnungen-Liste */
.status-cockpit-warnings {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}
.cockpit-warning {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-family: inherit;
  transition: transform 0.1s, box-shadow 0.1s;
}
.cockpit-warning:hover {
  transform: translateX(2px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.cockpit-warning-icon { font-size: 18px; flex-shrink: 0; }
.cockpit-warning-text { flex: 1; font-size: 13.5px; font-weight: 500; color: var(--ink-1); }
.cockpit-warning-arrow { color: var(--ink-3); font-size: 16px; }
.cockpit-red {
  border-left: 4px solid var(--red, #c0392b);
  background: color-mix(in srgb, var(--red, #c0392b) 5%, var(--paper));
}
.cockpit-amber {
  border-left: 4px solid var(--amber, #d98e04);
  background: color-mix(in srgb, var(--amber, #d98e04) 5%, var(--paper));
}
.cockpit-blue {
  border-left: 4px solid var(--brand-blue, #1a3a6b);
}

/* Kennzahlen-Cards */
.cockpit-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}
.cockpit-stat {
  position: relative;
  padding: 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: transform 0.1s, box-shadow 0.1s, border-color 0.1s;
}
.cockpit-stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.07);
  border-color: var(--brand-blue, #1a3a6b);
}
.cockpit-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--ink-1);
  line-height: 1;
}
.cockpit-stat-label {
  font-size: 11.5px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 6px;
}
.cockpit-stat-badge {
  display: inline-block;
  margin-top: 8px;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}
.badge-red { background: color-mix(in srgb, var(--red, #c0392b) 15%, transparent); color: var(--red, #c0392b); }
.badge-amber { background: color-mix(in srgb, var(--amber, #d98e04) 18%, transparent); color: var(--amber, #b5740a); }
.badge-green { background: color-mix(in srgb, var(--green, #2c8745) 15%, transparent); color: var(--green, #2c8745); }

@media (max-width: 900px) {
  .cockpit-stats { grid-template-columns: repeat(2, 1fr); }
  .cockpit-stat-value { font-size: 24px; }
  .status-cockpit-banner { padding: 14px; }
}
@media (max-width: 480px) {
  .cockpit-stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .cockpit-stat { padding: 12px; }
}

/* ============ Kontakt-Card (Build 0.26.1) ============ */
.contact-list {
  display: flex;
  flex-direction: column;
}
.contact-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.contact-row:last-child { border-bottom: none; }
.contact-icon {
  font-size: 15px;
  line-height: 1.4;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
  opacity: 0.7;
}
.contact-body {
  flex: 1;
  min-width: 0;
}
.contact-label {
  font-size: 10.5px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}
.contact-value {
  font-size: 14px;
  color: var(--ink-1);
  line-height: 1.4;
}
/* Telefonnummer nie mitten umbrechen */
.contact-value.contact-phone { white-space: nowrap; }
/* E-Mail darf an @ / . umbrechen statt zu überlaufen */
.contact-link {
  word-break: break-word;
  overflow-wrap: anywhere;
  text-decoration: none;
  color: var(--brand-blue, #1a3a6b);
}
.contact-link:hover { text-decoration: underline; }

/* ============================================================
   Build 0.27.0 · Mobile-Politur (Vollüberarbeitung)
   Deckt alle seit 0.23.0 neuen Elemente ab + Feinschliff
============================================================ */

/* --- Globale Overflow-Sicherung --- */
@media (max-width: 900px) {
  html, body { overflow-x: hidden; max-width: 100%; }
  .main { overflow-x: hidden; }
  /* Bilder & Medien nie breiter als Viewport */
  img, .md-image, .map-frame, table, pre, .md-code { max-width: 100%; }
  pre, .md-code { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* --- Status-Cockpit Warnungen auf Mobile --- */
@media (max-width: 900px) {
  .cockpit-warning {
    padding: 11px 13px;
    gap: 10px;
  }
  .cockpit-warning-text { font-size: 12.5px; line-height: 1.35; }
  .cockpit-warning-icon { font-size: 16px; }
  .status-cockpit-banner { gap: 12px; padding: 13px; }
  .cockpit-ok .cockpit-icon { width: 34px; height: 34px; font-size: 17px; }
  .cockpit-title { font-size: 14px; }
  .cockpit-sub { font-size: 11.5px; }
}

/* --- Cockpit-Stats: 2 Spalten Mobile, 1 Spalte sehr klein --- */
@media (max-width: 560px) {
  .cockpit-stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 380px) {
  .cockpit-stats { grid-template-columns: 1fr; }
}

/* --- Kontakt-Card --- */
@media (max-width: 900px) {
  .contact-row { padding: 11px 14px; }
  .contact-value { font-size: 14px; }
  /* Telefon auf sehr kleinen Screens darf umbrechen statt zu überlaufen */
}
@media (max-width: 360px) {
  .contact-value.contact-phone { white-space: normal; }
}

/* --- Editor: Vorschau & Body auf Mobile --- */
@media (max-width: 900px) {
  .md-editor-body textarea { font-size: 16px !important; min-height: 90px; }
  .md-preview { font-size: 14px; padding: 12px; }
  .md-preview img, .md-content img { max-width: 100%; height: auto; }
  /* Toolbar-Buttons als kompakte Reihe, Vorschau-Button rechts */
  .md-editor-toolbar { padding: 6px; }
  .md-btn { min-height: 36px; }
  .md-sep { display: none; }
  .md-paste-hint { display: none; }
}

/* --- Dossier-Grid: rechte Spalte (Karte/Kontakt) unter linke --- */
@media (max-width: 900px) {
  .dossier-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }
  /* Standort-Karte etwas niedriger auf Mobile */
  .map-frame { height: 220px !important; min-height: 220px; }
}

/* --- Infra-Sektionen: Header umbruchsicher --- */
@media (max-width: 900px) {
  .infra-section-header {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
  }
  .infra-section-header > div:last-child {
    width: 100%;
    display: flex;
    gap: 6px;
  }
  .infra-section-header > div:last-child .btn,
  .infra-section-header > div:last-child form {
    flex: 1 1 auto;
  }
  .infra-section-header .btn { justify-content: center; }
  .infra-section-title { font-size: 14px; }
  /* Reorder-Pfeile bleiben vertikal, nur etwas größer für Touch */
  .infra-reorder-controls .icon-btn { width: 30px !important; height: 26px !important; min-height: 26px !important; }
}

/* --- Backup-Tab: Job-Karten Header --- */
@media (max-width: 900px) {
  .backup-job-header, .backup-config-header {
    flex-wrap: wrap;
    gap: 6px;
  }
  /* Restore-Test-Zeile umbrechen */
  .restore-test-row {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 6px;
  }
}

/* --- O365-Tenant KV + User-Liste --- */
@media (max-width: 900px) {
  /* Tenant-Detail-Buttons volle Breite */
  .o365-tenant-actions { width: 100%; display: flex; gap: 8px; flex-wrap: wrap; }
  .o365-tenant-actions .btn { flex: 1 1 auto; justify-content: center; }
}

/* --- Timeline auf Mobile --- */
@media (max-width: 900px) {
  .timeline-item { padding-left: 28px; }
  .timeline-detail { font-size: 12px; }
}

/* --- Modals: Editor-Felder in Bottom-Sheet-Modals --- */
@media (max-width: 900px) {
  .modal .md-editor-wrap { margin-bottom: 8px; }
  .modal .md-editor-body textarea { min-height: 80px; }
}

/* --- Suchfeld in Topbar nicht zu schmal --- */
@media (max-width: 900px) {
  .topbar .search { min-width: 140px; }
  .topbar .search input { width: 100%; }
}

/* --- Tabellen-Zellen mit langem mono-Text (IP, Keys) umbruchsicher --- */
@media (max-width: 900px) {
  .table-wrap { max-width: 100%; }
  .infra-table td.mono .row-value { word-break: break-all; }
}

/* --- Buttons in Card-Headern nicht überquellen --- */
@media (max-width: 900px) {
  .card-header { flex-wrap: wrap; gap: 6px; row-gap: 8px; }
  .card-header .btn-sm { font-size: 11.5px; padding: 6px 10px; min-height: 32px; }
}

/* ============ VPN-Benutzer (Build 0.28.0) ============ */
.vpn-files-list { display: flex; flex-direction: column; gap: 6px; }
.vpn-file-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 6px;
}
@media (max-width: 900px) {
  .vpn-user-card .card-header { flex-wrap: wrap; }
  .vpn-file-row { flex-wrap: wrap; }
  .vpn-file-row span:first-child { flex: 1 1 100%; }
}

/* ============ Gesperrte Reiter (Build 0.29.0) ============ */
.tab-locked {
  opacity: 0.4;
  cursor: not-allowed !important;
  color: var(--ink-3) !important;
}
.tab-locked:hover { background: transparent !important; border-color: transparent !important; }

/* ============ Meta-Reiter (Timeline/Verlauf) rechts abtrennen (Build 0.30.0) ============ */
.tabs-spacer {
  flex: 1 1 auto;
  min-width: 12px;
}
.tab-meta {
  color: var(--ink-3);
}
.tab-meta::before {
  content: "";
  display: inline-block;
  width: 1px;
  height: 16px;
  background: var(--line);
  margin-right: 14px;
  vertical-align: middle;
}
/* Trenner nur beim ERSTEN Meta-Tab zeigen */
.tab-meta ~ .tab-meta::before { display: none; }

/* Auf Mobile: Spacer wegnehmen, sonst kollabiert horizontale Scroll-Leiste */
@media (max-width: 900px) {
  .tabs-spacer { display: none; }
  .tab-meta::before { margin-right: 8px; }
}

/* ============ Kunden-Archiv (Build 0.31.0) ============ */
.archive-banner {
  background: #fdf6e3;
  background: color-mix(in srgb, var(--amber) 12%, var(--paper));
  border: 1px solid var(--amber);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 18px;
  font-size: 13px;
}
@media (max-width: 900px) {
  .archive-banner { font-size: 12.5px; }
}

/* ============ Hardware-Tabelle: kompakt bei vielen Spalten (Build 0.33.1) ============ */
.hardware-table th, .hardware-table td {
  padding: 6px 8px;
  white-space: nowrap;
}
/* Lange Freitext-Spalten (Akku/Zubehör/Besonderes) einzeilig mit … kappen.
   Per Klasse statt :nth-child, weil die Checkbox-Spalte (nur bei Edit-Recht)
   die Spalten-Nummerierung verschiebt. So sind alle Zeilen gleich hoch. */
.hardware-table td.hw-trunc {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============ Hardware Mehrfachauswahl (Build 0.33.2) ============ */
.hw-bulk-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: var(--bg-2);
  border: 1px solid var(--brand-blue);
  border-radius: 8px;
  font-size: 13px;
}
.hw-bulk-bar strong { color: var(--brand-blue); }
