/* BiegeBox – Modern Design System */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* BiegeBox Brand */
  --bb-primary: #003B7E;
  --bb-primary-dark: #002B5C;
  --bb-primary-light: #E8F0FE;
  --bb-accent: #FFC600;
  --bb-accent-hover: #E5B200;
  --bb-text: #1a202c;
  --bb-text-light: #718096;
  --bb-bg: #f8fafc;
  --bb-white: #ffffff;
  --bb-success: #38a169;
  --bb-warning: #FFC600;
  --bb-error: #e53e3e;
  --bb-border: #e2e8f0;
  --bb-sidebar: #003B7E;
  --bb-sidebar-hover: #002B5C;
  --bb-sidebar-active: #FFC600;

  /* Legacy aliases (used throughout existing CSS) */
  --primary: #003B7E;
  --primary-light: #002B5C;
  --primary-lighter: #E8F0FE;
  --bg: #f8fafc;
  --bg-dark: #edf2f7;
  --white: #ffffff;
  --gray-50: #f7fafc;
  --gray-100: #edf2f7;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e0;
  --gray-400: #a0aec0;
  --gray-500: #718096;
  --gray-600: #4a5568;
  --gray-700: #2d3748;
  --gray-800: #1a202c;
  --gray-900: #171923;
  --green: #38a169;
  --green-light: #f0fff4;
  --orange: #dd6b20;
  --orange-light: #fffaf0;
  --red: #e53e3e;
  --red-light: #fff5f5;
  --blue: #003B7E;
  --blue-light: #E8F0FE;
  --yellow: #FFC600;
  --yellow-light: #fffff0;
  --radius: 8px;
  --radius-btn: 6px;
  --radius-input: 4px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
  --sidebar-width: 260px;
  --transition: 0.2s ease;
}

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

body {
  font-family: 'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--gray-700);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout Shell ────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--primary);
  padding: 1.75rem 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 100;
  transition: transform var(--transition);
  overflow-y: auto;
}

.sidebar .brand { font-size: 1.35rem; font-weight: 700; color: #fff; margin-bottom: .15rem; padding: 0 .75rem; letter-spacing: 0.02em; }
.sidebar .subtitle { font-size: .72rem; color: rgba(255,255,255,0.5); margin-bottom: 2rem; padding: 0 .75rem; text-transform: uppercase; letter-spacing: 0.08em; }
.sidebar nav { flex: 1; }
.sidebar nav a { display: flex; align-items: center; gap: .75rem; padding: .7rem .85rem; border-radius: var(--radius-btn); color: rgba(255,255,255,0.7); text-decoration: none; font-size: .875rem; font-weight: 500; transition: all var(--transition); margin-bottom: .2rem; }
.sidebar nav a .nav-icon { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.sidebar nav a:hover { background: rgba(255,255,255,0.1); color: #fff; }
.sidebar nav a.active { background: rgba(255,255,255,0.15); color: #fff; font-weight: 600; }
.sidebar .user-box { border-top: 1px solid rgba(255,255,255,0.15); padding-top: 1rem; margin-top: auto; padding-left: .75rem; padding-right: .75rem; }
.sidebar .user-box .name { font-weight: 600; font-size: .875rem; color: #fff; }
.sidebar .user-box .role { font-size: .75rem; color: rgba(255,255,255,0.5); margin-top: .1rem; }
.sidebar .user-box a { display: inline-flex; align-items: center; gap: .3rem; margin-top: .6rem; font-size: .78rem; color: rgba(255,255,255,0.6); text-decoration: none; transition: color var(--transition); }
.sidebar .user-box a:hover { color: #fff; }

/* Mobile toggle */
.sidebar-toggle { display: none; position: fixed; top: 1rem; left: 1rem; z-index: 200; background: var(--primary); color: #fff; border: none; border-radius: var(--radius-btn); width: 40px; height: 40px; font-size: 1.2rem; cursor: pointer; box-shadow: var(--shadow-md); align-items: center; justify-content: center; }

/* ── Main Content ────────────────────────────────── */
.main { margin-left: var(--sidebar-width); flex: 1; padding: 2rem 2.5rem; max-width: 1400px; }

/* ── Header Bar ──────────────────────────────────── */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.75rem; padding-bottom: 1rem; border-bottom: 1px solid var(--gray-200); }
.page-header h1 { font-size: 1.5rem; font-weight: 700; color: var(--primary); }
.page-header .header-right { display: flex; align-items: center; gap: 1rem; }
.page-subtitle { font-size: .9rem; color: var(--gray-500); margin-top: .15rem; }

/* ── Cards ───────────────────────────────────────── */
.card { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); transition: box-shadow var(--transition); }
.card:hover { box-shadow: var(--shadow-md); }
.card + .card { margin-top: 1rem; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; padding-bottom: .75rem; border-bottom: 1px solid var(--gray-100); }
.card-header h2 { font-size: 1.05rem; font-weight: 600; color: var(--primary); }

/* ── Detail Cards (Project Detail) ───────────────── */
.detail-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.detail-card { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.detail-card h3 { font-size: .72rem; font-weight: 600; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: .75rem; }
.detail-card p { font-size: .875rem; color: var(--gray-700); margin-bottom: .25rem; }
.tag-list { display: flex; flex-wrap: wrap; gap: .35rem; }

/* Detail grid for approve page */
.detail-grid { display: grid; grid-template-columns: 1fr; gap: .75rem; }
.detail-item { padding: .5rem 0; border-bottom: 1px solid var(--gray-100); }
.detail-item:last-child { border-bottom: none; }
.detail-label { font-size: .72rem; font-weight: 600; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: .15rem; }
.detail-value { font-size: .875rem; color: var(--gray-700); }

/* Quick-link tiles */
.quick-link { display: flex; flex-direction: column; align-items: center; justify-content: center; text-decoration: none; background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 2rem 1.5rem; box-shadow: var(--shadow); transition: all var(--transition); }
.quick-link:hover { box-shadow: var(--shadow-md); border-color: var(--primary-light); transform: translateY(-2px); }
.quick-link .quick-icon { font-size: 2.25rem; margin-bottom: .6rem; }
.quick-link .quick-label { font-weight: 600; color: var(--primary); font-size: .9rem; }

/* ── Stat tiles ──────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.75rem; }
.stat-tile { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 1.25rem 1rem; text-align: center; box-shadow: var(--shadow); transition: box-shadow var(--transition), transform var(--transition); }
.stat-tile:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-tile .number { font-size: 1.85rem; font-weight: 700; color: var(--primary); line-height: 1.2; }
.stat-tile .label { font-size: .78rem; color: var(--gray-500); margin-top: .35rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.03em; }

/* ── Tables ──────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-btn); }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
thead { background: var(--gray-50); }
th { text-align: left; padding: .7rem .85rem; font-weight: 600; font-size: .75rem; color: var(--gray-500); border-bottom: 2px solid var(--gray-200); white-space: nowrap; text-transform: uppercase; letter-spacing: 0.04em; }
td { padding: .7rem .85rem; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
tbody tr:nth-child(even) td { background: var(--gray-50); }
tbody tr { transition: background var(--transition); }
tbody tr:hover td { background: var(--primary-lighter); }

/* Sortable columns */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--primary); }
.sort-icon { font-size: .7rem; }

/* Clickable rows */
.clickable-row { cursor: pointer; }

/* ── Badges ──────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: .2rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 600; white-space: nowrap; letter-spacing: 0.01em; }
.badge-open { background: var(--orange-light); color: var(--orange); }
.badge-confirmed { background: var(--green-light); color: var(--green); }
.badge-call { background: var(--orange-light); color: var(--orange); }
.badge-error { background: var(--red-light); color: var(--red); }
.badge-pdf { background: var(--red-light); color: var(--red); }
.badge-bvbs { background: var(--primary-lighter); color: var(--primary); }
.badge-info { background: var(--primary-lighter); color: var(--primary-light); }
.badge-processing { background: var(--primary-lighter); color: var(--primary-light); animation: pulse-badge 1.5s ease-in-out infinite; }

/* Status badges */
.badge-status-entwurf { background: var(--gray-100); color: var(--gray-500); }
.badge-status-eingereicht { background: var(--orange-light); color: var(--orange); }
.badge-status-freigegeben { background: var(--green-light); color: var(--green); }
.badge-status-abgeschlossen { background: var(--blue-light); color: var(--blue); }

/* Abruf-Status badges (5-Status-Flow) */
.badge-abruf-offen { background: var(--red-light); color: var(--red); }
.badge-abruf-auf-abruf { background: var(--blue-light); color: var(--blue); }
.badge-abruf-terminbestaetigung-offen { background: var(--orange-light); color: var(--orange); }
.badge-abruf-bestaetigter-liefertermin { background: var(--green-light); color: var(--green); }
.badge-abruf-ausgeliefert { background: var(--gray-100); color: var(--gray-500); }

@keyframes pulse-badge { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

/* ── Buttons ─────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem 1.15rem; border: none; border-radius: var(--radius-btn); font-size: .875rem; font-weight: 500; cursor: pointer; transition: all var(--transition); text-decoration: none; font-family: inherit; line-height: 1.4; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(26,54,93,0.2); }
.btn-primary:hover { background: var(--primary-light); box-shadow: 0 2px 4px rgba(26,54,93,0.25); transform: translateY(-1px); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #c53030; transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--gray-600); border: 1px solid var(--gray-300); }
.btn-ghost:hover { background: var(--gray-50); border-color: var(--gray-400); }
.btn-sm { padding: .3rem .7rem; font-size: .78rem; }
.btn-lg { padding: .7rem 1.5rem; font-size: 1rem; font-weight: 600; }

/* ── Forms ───────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .82rem; font-weight: 600; color: var(--gray-600); margin-bottom: .35rem; }
.form-control { width: 100%; padding: .6rem .85rem; border: 1.5px solid var(--gray-300); border-radius: var(--radius-input); font-size: .875rem; font-family: inherit; color: var(--gray-700); background: var(--white); transition: all var(--transition); }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,54,93,0.12); }
.form-control::placeholder { color: var(--gray-400); }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23718096' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .75rem center; padding-right: 2rem; }
textarea.form-control { resize: vertical; }

.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-hint { font-size: .75rem; color: var(--gray-400); margin-top: .25rem; }
.required { color: var(--red); font-weight: 700; }
.form-section-divider { font-size: .72rem; font-weight: 600; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.06em; border-bottom: 1px solid var(--gray-200); padding-bottom: .4rem; margin: 1.5rem 0 1rem; }

/* Toggle buttons (Zufahrt) */
.toggle-buttons { display: flex; flex-wrap: wrap; gap: .5rem; }
.toggle-btn { display: inline-flex; cursor: pointer; }
.toggle-btn input { display: none; }
.toggle-btn span { padding: .5rem 1rem; border: 1.5px solid var(--gray-300); border-radius: 999px; font-size: .82rem; font-weight: 500; color: var(--gray-600); transition: all var(--transition); background: var(--white); }
.toggle-btn input:checked + span { background: var(--primary); color: #fff; border-color: var(--primary); }
.toggle-btn span:hover { border-color: var(--primary-light); color: var(--primary); }

/* ── File upload ─────────────────────────────────── */
.upload-zone { border: 2px dashed var(--gray-300); border-radius: var(--radius); padding: 2.5rem 2rem; text-align: center; color: var(--gray-500); cursor: pointer; transition: all var(--transition); position: relative; background: var(--gray-50); }
.upload-zone:hover, .upload-zone.dragover { border-color: var(--primary); background: var(--primary-lighter); color: var(--primary); }
.upload-zone .upload-icon { font-size: 2.5rem; margin-bottom: .5rem; opacity: 0.7; }
.upload-zone p { font-size: .875rem; font-weight: 500; }
.upload-zone .upload-hint { font-size: .75rem; color: var(--gray-400); margin-top: .25rem; }
.upload-zone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-spinner { display: none; align-items: center; gap: .5rem; padding: .75rem 1rem; background: var(--primary-lighter); border-radius: var(--radius-btn); font-size: .85rem; color: var(--primary); font-weight: 500; margin-top: .75rem; }
.upload-spinner.active { display: inline-flex; }
.spinner { width: 18px; height: 18px; border: 2.5px solid var(--gray-300); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Alerts ──────────────────────────────────────── */
.alert { padding: .8rem 1.1rem; border-radius: var(--radius-btn); font-size: .875rem; margin-bottom: 1rem; font-weight: 500; display: flex; align-items: center; gap: .5rem; }
.alert-error { background: var(--red-light); color: var(--red); border-left: 4px solid var(--red); }
.alert-success { background: var(--green-light); color: var(--green); border-left: 4px solid var(--green); }
.alert-info { background: var(--primary-lighter); color: var(--primary-light); border-left: 4px solid var(--primary); }

/* ── Toast Notifications ─────────────────────────── */
.toast-container { position: fixed; top: 1.25rem; right: 1.25rem; z-index: 9999; display: flex; flex-direction: column; gap: .5rem; pointer-events: none; }
.toast { pointer-events: auto; padding: .85rem 1.25rem; border-radius: var(--radius-btn); font-size: .875rem; font-weight: 500; color: #fff; box-shadow: var(--shadow-lg); transform: translateX(120%); animation: toast-in 0.35s ease forwards; max-width: 380px; display: flex; align-items: center; gap: .5rem; }
.toast.toast-out { animation: toast-out 0.3s ease forwards; }
.toast-success { background: var(--green); }
.toast-error { background: var(--red); }
.toast-info { background: var(--primary); }
@keyframes toast-in { to { transform: translateX(0); } }
@keyframes toast-out { to { transform: translateX(120%); opacity: 0; } }

/* ── Login page ──────────────────────────────────── */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%); padding: 1rem; }
.login-card { background: var(--white); border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,0.15); padding: 3rem 2.5rem; width: 100%; max-width: 420px; }
.login-card .login-logo { text-align: center; margin-bottom: 2rem; }
.login-card .login-logo .logo-icon { width: 56px; height: 56px; background: var(--primary); color: #fff; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.5rem; font-weight: 700; margin-bottom: .75rem; }
.login-card h1 { text-align: center; color: var(--primary); font-size: 1.75rem; font-weight: 700; margin-bottom: .15rem; letter-spacing: -0.01em; }
.login-card .sub { text-align: center; color: var(--gray-500); font-size: .875rem; margin-bottom: 2rem; }
.tab-row { display: flex; background: var(--gray-50); border-radius: var(--radius-btn); padding: .25rem; margin-bottom: 1.5rem; gap: .25rem; }
.tab-row button { flex: 1; background: none; border: none; padding: .55rem .75rem; font-size: .85rem; font-weight: 500; color: var(--gray-500); cursor: pointer; border-radius: 4px; transition: all var(--transition); font-family: inherit; }
.tab-row button.active { background: var(--white); color: var(--primary); box-shadow: var(--shadow); font-weight: 600; }
.tab-row button:hover:not(.active) { color: var(--gray-700); }

/* ── Project detail panel ────────────────────────── */
.project-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: .75rem; margin-bottom: 1.75rem; padding-bottom: 1rem; border-bottom: 1px solid var(--gray-200); }
.project-header h1 { font-size: 1.4rem; color: var(--primary); font-weight: 700; }
.project-meta { font-size: .82rem; color: var(--gray-500); margin-top: .25rem; }

/* ── Pagination ──────────────────────────────────── */
.pagination-wrap { display: flex; justify-content: space-between; align-items: center; padding: 1rem 0 .5rem; border-top: 1px solid var(--gray-100); margin-top: .5rem; }
.pagination-info { font-size: .78rem; color: var(--gray-500); }
.pagination-buttons { display: flex; gap: .25rem; }
.page-btn { min-width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--gray-300); border-radius: var(--radius-input); background: var(--white); color: var(--gray-600); font-size: .78rem; font-family: inherit; cursor: pointer; transition: all var(--transition); }
.page-btn:hover:not(:disabled):not(.active) { background: var(--gray-50); border-color: var(--gray-400); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: .4; cursor: default; }

/* ── Calendar ────────────────────────────────────── */
.calendar { margin-bottom: 1rem; }
.cal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .75rem; }
.cal-title { font-weight: 600; font-size: 1rem; color: var(--primary); }
.cal-nav { background: none; border: 1px solid var(--gray-300); border-radius: var(--radius-input); width: 32px; height: 32px; cursor: pointer; font-size: 1rem; color: var(--gray-600); display: inline-flex; align-items: center; justify-content: center; transition: all var(--transition); }
.cal-nav:hover { background: var(--gray-50); border-color: var(--gray-400); }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: .68rem; font-weight: 600; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: .35rem; }
.cal-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-day { display: flex; align-items: center; justify-content: center; height: 36px; border-radius: var(--radius-input); font-size: .82rem; cursor: pointer; transition: all var(--transition); color: var(--gray-700); }
.cal-day:hover:not(.disabled):not(.selected) { background: var(--gray-100); }
.cal-day.disabled { color: var(--gray-300); cursor: default; }
.cal-day.selected { background: var(--primary); color: #fff; font-weight: 600; }
.cal-day.today { border: 2px solid var(--primary); }
.cal-day.empty { cursor: default; }
.cal-selected-text { font-size: .85rem; font-weight: 600; color: var(--primary); text-align: center; min-height: 1.5rem; margin-bottom: .5rem; }

/* ── Bemerkungen ─────────────────────────────────── */
.bemerkungen-row td { padding: 0 !important; }
.dot-indicator { display: inline-block; width: 6px; height: 6px; background: var(--orange); border-radius: 50%; margin-left: 2px; vertical-align: top; }

/* ── Toolbar (search + filters) ──────────────────── */
.toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-bottom: 1.25rem; }
.search-box { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.search-box .search-icon { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--gray-400); font-size: .9rem; pointer-events: none; }
.search-box input { width: 100%; padding: .55rem .85rem .55rem 2.2rem; border: 1.5px solid var(--gray-300); border-radius: 999px; font-size: .85rem; font-family: inherit; color: var(--gray-700); background: var(--white); transition: all var(--transition); }
.search-box input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,54,93,0.1); }
.search-box input::placeholder { color: var(--gray-400); }
.filter-pills { display: flex; gap: .3rem; flex-wrap: wrap; }
.pill { padding: .35rem .85rem; border-radius: 999px; border: 1.5px solid var(--gray-300); background: var(--white); color: var(--gray-600); font-size: .78rem; font-weight: 500; cursor: pointer; transition: all var(--transition); font-family: inherit; }
.pill:hover { border-color: var(--primary-light); color: var(--primary); }
.pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.sort-select { padding: .45rem .75rem .45rem .5rem; border: 1.5px solid var(--gray-300); border-radius: 999px; font-size: .78rem; font-family: inherit; color: var(--gray-600); background: var(--white); cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%23718096' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .6rem center; padding-right: 1.6rem; transition: all var(--transition); }
.sort-select:focus { outline: none; border-color: var(--primary); }

/* ── Modal ──────────────────────────────────────── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1000; align-items: center; justify-content: center; padding: 1rem; }
.modal-overlay.open { display: flex; }
.modal { background: var(--white); border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); width: 100%; max-width: 480px; padding: 2rem; animation: modal-in 0.2s ease; }
@keyframes modal-in { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal h2 { font-size: 1.15rem; font-weight: 700; color: var(--primary); margin-bottom: 1.25rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--gray-100); }

/* ── Empty state ────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--gray-400); }
.empty-state-icon { font-size: 3rem; margin-bottom: .75rem; opacity: .5; }
.empty-state-text { font-size: .9rem; font-weight: 500; color: var(--gray-500); margin-bottom: .25rem; }
.empty-state-sub { font-size: .8rem; color: var(--gray-400); }

/* ── Action buttons in table ─────────────────────── */
.action-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--radius-btn); border: 1px solid var(--gray-200); background: var(--white); color: var(--gray-500); cursor: pointer; transition: all var(--transition); text-decoration: none; font-size: .9rem; position: relative; }
.action-btn:hover { background: var(--gray-50); border-color: var(--gray-300); color: var(--gray-700); }
.action-btn.action-danger:hover { background: var(--red-light); border-color: var(--red); color: var(--red); }

/* Section label */
.section-title { font-size: .72rem; font-weight: 600; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: .75rem; }

/* Change row highlight */
tr.row-changed td { background: var(--orange-light) !important; }

/* ── Misc ────────────────────────────────────────── */
.text-muted { color: var(--gray-500); }
.text-blue { color: var(--primary); }
.text-green { color: var(--green); }
.text-orange { color: var(--orange); }
.text-red { color: var(--red); }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,0.2); }
  .sidebar-toggle { display: flex; }
  .main { margin-left: 0; padding: 1.25rem 1rem; padding-top: 4rem; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; gap: .5rem; }
  .project-header { flex-direction: column; }
  .login-card { padding: 2rem 1.5rem; }
  .detail-cards { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search-box { max-width: 100%; }
  .filter-pills { flex-wrap: wrap; }
  .form-row { flex-direction: column; gap: 0; }
}

@media (min-width: 769px) {
  .sidebar-toggle { display: none !important; }
}

.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 90; }
.sidebar-overlay.active { display: block; }

/* Map embed */
.map-embed { border-radius: var(--radius-btn); overflow: hidden; }

/* ── Bauführer-specific layouts ──────────────────── */

/* 2/3-column stats row */
.stats-row-2 { grid-template-columns: repeat(2, 1fr); }
.stats-row-3 { grid-template-columns: repeat(3, 1fr); }

/* Large quick-link buttons */
.quick-links-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-bottom: 1.75rem; }
.quick-link-lg { min-height: 120px; padding: 2rem; }
.quick-link-lg .quick-icon { font-size: 2.75rem; margin-bottom: .75rem; }
.quick-link-lg .quick-label { font-size: 1.05rem; }

/* 3-column detail cards (fixed) */
.detail-cards-3 { grid-template-columns: repeat(3, 1fr); }

/* Sub-titles in detail cards */
.detail-sub-title { font-size: .72rem; font-weight: 600; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.06em; margin-top: .85rem; margin-bottom: .25rem; }

/* Upload card */
.upload-card { display: flex; flex-direction: column; }
.upload-card h3 { font-size: .72rem; font-weight: 600; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: .75rem; }
.upload-card form { flex: 1; display: flex; flex-direction: column; }

/* Compact upload zone (fits in card height) */
.upload-zone-compact { padding: 1.5rem 1rem; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.upload-zone-compact .upload-icon { font-size: 2rem; margin-bottom: .35rem; }
.upload-zone-compact p { font-size: .82rem; }

/* Disabled upload zone */
.upload-zone-disabled { border: 2px dashed var(--gray-200); border-radius: var(--radius); padding: 2rem 1rem; text-align: center; color: var(--gray-400); background: var(--gray-50); flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.upload-zone-disabled .upload-icon { font-size: 2rem; margin-bottom: .5rem; }
.upload-zone-disabled p { font-size: .82rem; font-weight: 500; }

@media (max-width: 768px) {
  .stats-row-2 { grid-template-columns: 1fr; }
  .stats-row-3 { grid-template-columns: 1fr; }
  .quick-links-grid { grid-template-columns: 1fr; }
  .detail-cards-3 { grid-template-columns: 1fr; }
}

/* ── Projekt-Sperre Banner ── */
.lock-banner { padding: .6rem 1rem; border-radius: var(--radius-btn); font-size: .85rem; margin-bottom: 1rem; }
.lock-banner-own { background: var(--blue-light); color: var(--blue); border: 1px solid var(--blue); }
.lock-banner-other { background: var(--orange-light); color: var(--orange); border: 1px solid var(--orange); }

/* ═══════════════════════════════════════════════════════
   MODAL-UMBAU: Detail Modal, Clickable Rows, Badges
   ═══════════════════════════════════════════════════════ */

/* Clickable table rows */
tr.clickable-row { cursor: pointer; transition: background var(--transition); }
tr.clickable-row:hover { background: var(--primary-lighter) !important; }

/* Bemerkung badge (counter) */
.bemerkung-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 10px; font-size: .7rem; font-weight: 700;
  line-height: 1; color: var(--white);
}
.bemerkung-badge-rot { background: var(--red); }
.bemerkung-badge-blau { background: var(--primary); }

/* Detail Modal */
.modal-detail { max-height: 90vh; overflow-y: auto; }
.modal-detail-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: .75rem; }
.modal-status-line { font-size: .88rem; margin-bottom: 1rem; padding-bottom: .75rem; border-bottom: 1px solid var(--gray-100); }

/* Modal sections */
.modal-section { margin-bottom: 1rem; }
.modal-section-title {
  font-size: .72rem; font-weight: 700; color: var(--gray-400);
  text-transform: uppercase; letter-spacing: .08em;
  margin-bottom: .5rem; padding-bottom: .25rem;
  border-bottom: 1px solid var(--gray-100);
}
.modal-section-body { font-size: .88rem; }

/* Modal detail table */
.modal-detail-table { width: 100%; border-collapse: collapse; }
.modal-detail-table td { padding: .3rem .5rem; vertical-align: top; }
.modal-detail-table td:first-child { color: var(--gray-500); width: 40%; white-space: nowrap; }
.modal-detail-table td:last-child { font-weight: 500; }

/* Modal footer */
.modal-footer { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; padding-top: .75rem; border-top: 1px solid var(--gray-100); }

/* Bemerkungen chat bubbles */
.bem-list { max-height: 200px; overflow-y: auto; margin-bottom: .75rem; }
.bem-bubble { padding: .5rem .75rem; border-radius: 8px; margin-bottom: .5rem; font-size: .85rem; }
.bem-kunde { background: var(--gray-50); border-left: 3px solid var(--primary-light); }
.bem-avor { background: var(--green-light); border-left: 3px solid var(--green); }
.bem-meta { font-size: .7rem; color: var(--gray-400); margin-bottom: .2rem; }
.bem-text { white-space: pre-wrap; word-break: break-word; }
.bem-input-row { margin-top: .5rem; }


/* ═══════════════════════════════════════════════════════
   PENDENZEN: Übersicht + Dashboard Widget
   ═══════════════════════════════════════════════════════ */

/* Sidebar badge (red counter) */
.sidebar-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px; font-size: .68rem; font-weight: 700;
  background: var(--red); color: #fff;
  margin-left: auto; line-height: 1;
}

/* 4-column stats row */
.stats-row-4 { grid-template-columns: repeat(4, 1fr); }

/* Urgency dots */
.urgency-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  flex-shrink: 0;
}
.urgency-critical { background: #dc2626; }
.urgency-high { background: #ea580c; }
.urgency-medium { background: #ca8a04; }
.urgency-none { background: #9ca3af; }

/* Status tile dots (pendenzen header) */
.pend-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; margin-bottom: .25rem;
}
.pend-dot-offen { background: var(--red); }
.pend-dot-auf-abruf { background: var(--primary); }
.pend-dot-termin-offen { background: var(--orange); }

/* Clickable status tiles */
.pend-tile { cursor: pointer; position: relative; border: 2px solid transparent; }
.pend-tile:hover { border-color: var(--gray-300); }
.pend-tile-active { border-color: var(--primary) !important; }

/* Text helpers */
.text-danger { color: var(--red) !important; font-weight: 600; }
.text-warning { color: var(--orange) !important; font-weight: 600; }

/* Pendenzen table */
.pend-table { width: 100%; }
.pend-table th { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.pend-table td { font-size: .85rem; vertical-align: middle; }
.pend-table td:first-child { width: 30px; text-align: center; }

/* Unread row highlight */
.pend-row-unread { background: var(--yellow-light) !important; }

/* Filtered-out rows (client-side filter) */
.filtered-out { display: none !important; }

/* Form control small */
.form-control-sm { font-size: .82rem; padding: .35rem .6rem; }

/* ── Pendenzen mobile cards (hidden on desktop) ── */
.pend-mobile-cards { display: none; }
.pend-card {
  display: block; text-decoration: none; color: inherit;
  background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius);
  padding: .85rem 1rem; margin-bottom: .5rem;
  box-shadow: var(--shadow); transition: box-shadow var(--transition);
}
.pend-card:hover { box-shadow: var(--shadow-md); }
.pend-card-critical { border-left: 3px solid var(--red); }
.pend-card-high { border-left: 3px solid var(--orange); }
.pend-card-medium { border-left: 3px solid var(--yellow); }
.pend-card-none { border-left: 3px solid var(--gray-300); }
.pend-card-top { display: flex; align-items: center; gap: .5rem; margin-bottom: .4rem; }
.pend-card-termin { margin-left: auto; font-size: .78rem; font-weight: 600; }
.pend-card-body { }
.pend-card-kunde { font-weight: 600; font-size: .9rem; color: var(--primary); }
.pend-card-detail { font-size: .82rem; color: var(--gray-600); margin-top: .15rem; }
.pend-card-meta { font-size: .75rem; color: var(--gray-400); margin-top: .25rem; }

/* ── Dashboard pendenzen widget ── */
.pend-widget { }
.pend-widget-list { }
.pend-widget-row {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem .75rem; text-decoration: none; color: inherit;
  border-bottom: 1px solid var(--gray-100);
  transition: background var(--transition);
  font-size: .85rem;
}
.pend-widget-row:last-child { border-bottom: none; }
.pend-widget-row:hover { background: var(--primary-lighter); }
.pend-widget-kunde { font-weight: 600; color: var(--primary); min-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pend-widget-detail { flex: 1; color: var(--gray-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pend-widget-weight { font-size: .78rem; color: var(--gray-400); white-space: nowrap; }
.pend-widget-termin { font-size: .82rem; white-space: nowrap; min-width: 60px; text-align: right; }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .pend-col-avor, .pend-col-gewicht { display: none; }
}

@media (max-width: 768px) {
  .stats-row-4 { grid-template-columns: 1fr 1fr; }
  .pend-table-card { display: none; }
  .pend-mobile-cards { display: block; }
  .pend-widget-kunde { min-width: 80px; }
  .pend-widget-weight { display: none; }
}

/* ═══════════════════════════════════════════════════════
   BIEGEBOX BRAND ENHANCEMENTS
   ═══════════════════════════════════════════════════════ */

/* Primary button accent hover */
.btn-primary:hover {
  background: var(--bb-accent);
  color: var(--bb-primary-dark);
  box-shadow: 0 2px 4px rgba(0,59,126,0.25);
  transform: translateY(-1px);
}

/* Sidebar active link: yellow left border */
.sidebar nav a.active {
  background: rgba(255,255,255,0.1);
  border-left: 3px solid var(--bb-accent);
  padding-left: calc(.85rem - 3px);
  color: #fff;
  font-weight: 600;
}

/* Table header with brand color */
thead {
  background: var(--bb-primary);
}
th {
  color: #fff;
  border-bottom: 2px solid var(--bb-primary-dark);
}
th.sortable:hover {
  color: var(--bb-accent);
}

/* Table zebra striping with brand light */
tbody tr:nth-child(even) td {
  background: var(--bb-primary-light);
}
tbody tr:hover td {
  background: rgba(255, 198, 0, 0.1);
}

/* Card hover accent top border */
.card:hover {
  box-shadow: var(--shadow-md);
  border-top: 3px solid var(--bb-accent);
  padding-top: calc(1.5rem - 3px);
}

/* Upload zone brand styling */
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--bb-primary);
  background: var(--bb-primary-light);
  color: var(--bb-primary);
}

/* Login page brand gradient */
.login-wrap {
  background: linear-gradient(135deg, var(--bb-primary) 0%, var(--bb-primary-dark) 100%);
}

/* Login button accent hover */
.login-card .btn-primary:hover {
  background: var(--bb-accent);
  color: var(--bb-primary-dark);
}

/* Pill active with brand */
.pill.active {
  background: var(--bb-primary);
  color: #fff;
  border-color: var(--bb-primary);
}

/* Page btn active with brand */
.page-btn.active {
  background: var(--bb-primary);
  border-color: var(--bb-primary);
}

/* Sidebar brand styling */
.sidebar .brand-logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: 0 .75rem;
  margin-bottom: .15rem;
}
.sidebar .brand-logo img {
  height: 36px;
  width: auto;
}
.sidebar .version-footer {
  font-size: .65rem;
  color: rgba(255,255,255,0.3);
  padding: .5rem .75rem 0;
  text-align: center;
}
