@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@600;700;800&family=Inter:wght@300;400;500;600&display=swap');

:root {
  --sidebar-bg: #0A0A10;
  --sidebar-border: rgba(255,255,255,0.08);
  --sidebar-text: #EEEEF2;
  --main-bg: #F3F4F8;
  --card-bg: #FFFFFF;
  --card-border: #E4E5EE;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --card-shadow-hover: 0 4px 12px rgba(0,0,0,0.1);
  --text-primary: #0D0D1A;
  --text-secondary: #5C5C7A;
  --text-muted: #9898B2;
  --orange: #FF6B35;
  --pink: #F72585;
  --purple: #7209B7;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #f59e0b;
  --gradient: linear-gradient(135deg, #FF6B35, #F72585);
  --bg: #0A0A10;
  --border: rgba(255,255,255,0.08);
  --text: #EEEEF2;
  --font-heading: 'Plus Jakarta Sans', sans-serif;
  --font-body: 'Inter', sans-serif;
  --radius: 10px;
  --radius-lg: 14px;
  --nav-width: 248px;
}

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

body {
  background: var(--main-bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  min-height: 100vh;
}

/* ── LOGIN ───────────────────────────────────────────── */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--bg);
  background-image:
    radial-gradient(ellipse 60% 40% at 30% 20%, rgba(255,107,53,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 70% 80%, rgba(114,9,183,0.12) 0%, transparent 60%);
}
.login-container { width: 100%; max-width: 400px; padding: 24px; }
.login-card {
  background: #0F0F18; border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 40px; backdrop-filter: blur(20px);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo-text {
  font-family: var(--font-heading); font-size: 22px; font-weight: 800;
  background: var(--gradient); -webkit-background-clip: text;
  -webkit-text-fill-color: transparent; background-clip: text;
}
.login-logo-sub { color: rgba(255,255,255,0.3); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; margin-top: 2px; }
.login-title { font-family: var(--font-heading); font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 6px; color: var(--text); }
.login-subtitle { color: #8888A0; text-align: center; margin-bottom: 28px; font-size: 13px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 500; color: #8888A0; margin-bottom: 7px; }
.form-group input {
  width: 100%; background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px; color: var(--text);
  font-family: var(--font-body); font-size: 14px; outline: none; transition: border-color 0.2s;
}
.form-group input:focus { border-color: var(--orange); }
.form-group input::placeholder { color: #8888A0; }
.btn-primary {
  width: 100%; padding: 13px; background: var(--gradient); border: none;
  border-radius: var(--radius); color: white; font-family: var(--font-heading);
  font-size: 15px; font-weight: 600; cursor: pointer; margin-top: 8px;
  transition: opacity 0.2s, transform 0.1s;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: scale(0.99); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.error-msg {
  background: rgba(247,37,133,0.1); border: 1px solid rgba(247,37,133,0.3);
  color: var(--pink); padding: 10px 14px; border-radius: var(--radius);
  font-size: 13px; margin-bottom: 12px;
}
.login-footer { text-align: center; margin-top: 28px; color: #8888A0; font-size: 12px; }

/* ── LAYOUT ──────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }

/* ── SIDEBAR ─────────────────────────────────────────── */
.sidebar {
  width: var(--nav-width); background: var(--sidebar-bg);
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100vh; z-index: 100;
}
.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-logo-text {
  font-family: var(--font-heading); font-size: 17px; font-weight: 800;
  background: var(--gradient); -webkit-background-clip: text;
  -webkit-text-fill-color: transparent; background-clip: text;
}
.sidebar-logo-sub { color: rgba(255,255,255,0.25); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; margin-top: 2px; }
.sidebar-nav { flex: 1; padding: 14px 10px; overflow-y: auto; }
.nav-label {
  font-size: 10px; font-weight: 600; letter-spacing: 0.1em;
  color: rgba(255,255,255,0.25); padding: 10px 12px 4px;
  text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius);
  color: rgba(255,255,255,0.42); font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: all 0.15s; margin-bottom: 2px;
  text-decoration: none; position: relative;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.8); }
.nav-item.active { background: rgba(255,107,53,0.15); color: var(--orange); }
.nav-item svg { width: 15px; height: 15px; flex-shrink: 0; }
.nav-alert-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--red); margin-left: auto; flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(239,68,68,0.2);
  animation: pulse-red 2s infinite;
}
@keyframes pulse-red { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

.sidebar-footer {
  padding: 14px 10px; border-top: 1px solid rgba(255,255,255,0.06);
}
.user-info {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius); margin-bottom: 4px;
}
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--gradient);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading); font-weight: 700; font-size: 12px; color: white; flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 500; color: rgba(255,255,255,0.85); }
.user-role { font-size: 10px; color: rgba(255,255,255,0.3); }
.btn-logout {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 12px; background: none; border: none; border-radius: var(--radius);
  color: rgba(255,255,255,0.3); font-family: var(--font-body); font-size: 13px;
  cursor: pointer; transition: all 0.15s;
}
.btn-logout:hover { background: rgba(247,37,133,0.1); color: var(--pink); }

/* ── ALERT BANNER ────────────────────────────────────── */
.alert-banner {
  position: fixed; top: 0; left: var(--nav-width); right: 0;
  background: #fef2f2; border-bottom: 1px solid #fecaca;
  padding: 10px 32px; display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: #b91c1c; z-index: 90;
}
.alert-banner svg { width: 16px; height: 16px; flex-shrink: 0; color: #ef4444; }
.alert-link { color: #b91c1c; font-weight: 600; text-decoration: underline; margin-left: 6px; cursor: pointer; }

/* ── MAIN ────────────────────────────────────────────── */
.main {
  margin-left: var(--nav-width); flex: 1; padding: 32px;
  background: var(--main-bg); min-height: 100vh;
}
.main.has-alert { padding-top: 72px; }

/* Page header */
.page-header { margin-bottom: 24px; }
.page-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.page-title { font-family: var(--font-heading); font-size: 24px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.5px; }
.page-subtitle { color: var(--text-secondary); font-size: 13px; }
.gradient-text { background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

/* ── STATS GRID ──────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--card-shadow);
  position: relative; overflow: hidden; transition: box-shadow 0.2s, transform 0.2s;
}
.stat-card:hover { box-shadow: var(--card-shadow-hover); transform: translateY(-1px); }
.stat-card::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 3px; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.stat-card.orange::after { background: var(--orange); }
.stat-card.pink::after   { background: var(--pink); }
.stat-card.purple::after { background: var(--purple); }
.stat-card.green::after  { background: var(--green); }
.stat-card.red::after    { background: var(--red); }
.stat-icon { width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.stat-icon.orange { background: rgba(255,107,53,0.1);  color: var(--orange); }
.stat-icon.pink   { background: rgba(247,37,133,0.1);  color: var(--pink); }
.stat-icon.purple { background: rgba(114,9,183,0.1);   color: var(--purple); }
.stat-icon.green  { background: rgba(34,197,94,0.1);   color: var(--green); }
.stat-icon.red    { background: rgba(239,68,68,0.1);   color: var(--red); }
.stat-icon svg { width: 17px; height: 17px; }
.stat-value { font-family: var(--font-heading); font-size: 30px; font-weight: 800; line-height: 1; color: var(--text-primary); margin-bottom: 5px; letter-spacing: -1px; }
.stat-label { color: var(--text-secondary); font-size: 12px; font-weight: 500; }

/* ── SECTION CARD ────────────────────────────────────── */
.section-card {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--radius-lg); box-shadow: var(--card-shadow);
  overflow: hidden; margin-bottom: 20px;
}
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px; border-bottom: 1px solid var(--card-border);
}
.section-title { font-family: var(--font-heading); font-size: 14px; font-weight: 700; color: var(--text-primary); }
.section-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── TABLE ───────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 9px 22px; text-align: left; font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted);
  background: #FAFAFD; border-bottom: 1px solid var(--card-border); white-space: nowrap;
}
tbody tr { border-bottom: 1px solid #F0F0F8; transition: background 0.1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #FAFAFD; }
tbody td { padding: 12px 22px; font-size: 13px; color: var(--text-primary); vertical-align: middle; }

/* ── BADGES ──────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.03em;
}
.badge-starter     { background: rgba(255,107,53,0.1);  color: var(--orange); }
.badge-professional{ background: rgba(114,9,183,0.1);   color: var(--purple); }
.badge-business    { background: rgba(247,37,133,0.1);  color: var(--pink); }
.badge-aktiv       { background: rgba(34,197,94,0.1);   color: #16a34a; }
.badge-inaktiv     { background: rgba(148,163,184,0.15);color: #64748b; }
.badge-pause       { background: rgba(245,158,11,0.1);  color: #d97706; }
.badge-done        { background: rgba(34,197,94,0.1);   color: #16a34a; }
.badge-in-progress { background: rgba(255,107,53,0.1);  color: var(--orange); }
.badge-open        { background: rgba(148,163,184,0.15);color: #64748b; }
.badge-blocked     { background: rgba(239,68,68,0.1);   color: var(--red); }
.badge-neu         { background: rgba(59,130,246,0.1);  color: #2563eb; }
.badge-kontaktiert { background: rgba(245,158,11,0.1);  color: #d97706; }
.badge-angebot     { background: rgba(114,9,183,0.1);   color: var(--purple); }
.badge-gewonnen    { background: rgba(34,197,94,0.1);   color: #16a34a; }
.badge-verloren    { background: rgba(148,163,184,0.15);color: #64748b; }

.paket-badge {
  display: inline-flex; align-items: center; padding: 2px 10px;
  border-radius: 20px; font-size: 10px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--gradient); color: white;
}

/* ── STATUS DOT ──────────────────────────────────────── */
.status-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0;
}
.status-dot.green  { background: var(--green);  box-shadow: 0 0 0 3px rgba(34,197,94,0.15);  }
.status-dot.red    { background: var(--red);    box-shadow: 0 0 0 3px rgba(239,68,68,0.15);   animation: pulse-red 2s infinite; }
.status-dot.yellow { background: var(--yellow); box-shadow: 0 0 0 3px rgba(245,158,11,0.15); }
.status-dot.gray   { background: #94a3b8; }

/* ── SYSTEM STATUS GRID ──────────────────────────────── */
.system-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.site-list { padding: 4px 0; }
.site-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 22px; border-bottom: 1px solid #F0F0F8;
  transition: background 0.1s;
}
.site-row:last-child { border-bottom: none; }
.site-row:hover { background: #FAFAFD; }
.site-name { font-size: 13px; font-weight: 500; color: var(--text-primary); flex: 1; }
.site-url { font-size: 12px; color: var(--text-muted); text-decoration: none; }
.site-url:hover { color: var(--orange); }
.site-time { font-size: 11px; color: var(--text-muted); }
.refresh-row { display: flex; align-items: center; gap: 10px; }
.last-checked { font-size: 11px; color: var(--text-muted); }
.btn-refresh {
  display: flex; align-items: center; gap: 5px; padding: 5px 12px;
  background: none; border: 1px solid var(--card-border); border-radius: 8px;
  color: var(--text-secondary); font-size: 12px; cursor: pointer; transition: all 0.15s;
}
.btn-refresh:hover { background: var(--main-bg); color: var(--orange); border-color: rgba(255,107,53,0.3); }
.btn-refresh svg { width: 12px; height: 12px; }
.site-loading { padding: 30px 22px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ── TWO COL GRID ────────────────────────────────────── */
.two-col-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }

/* ── FINANCE ROWS ────────────────────────────────────── */
.finance-list { padding: 4px 0; }
.finance-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 22px; border-bottom: 1px solid #F0F0F8;
}
.finance-row:last-child { border-bottom: none; }
.finance-name { font-size: 13px; color: var(--text-primary); font-weight: 500; }
.finance-meta { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.finance-amount { font-family: var(--font-heading); font-size: 14px; font-weight: 700; color: var(--text-primary); }
.finance-amount.green { color: var(--green); }
.finance-amount.red   { color: var(--red); }
.finance-total-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; background: #FAFAFD; border-top: 1px solid var(--card-border);
}
.finance-total-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }
.finance-total-amount { font-family: var(--font-heading); font-size: 18px; font-weight: 800; }

/* P&L Card */
.pnl-card {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--radius-lg); box-shadow: var(--card-shadow);
  padding: 24px; margin-bottom: 20px;
}
.pnl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--card-border); border-radius: var(--radius); overflow: hidden; margin-top: 16px; }
.pnl-cell { background: var(--card-bg); padding: 18px 20px; }
.pnl-cell-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.pnl-cell-value { font-family: var(--font-heading); font-size: 26px; font-weight: 800; letter-spacing: -0.5px; }
.pnl-cell-value.green  { color: var(--green); }
.pnl-cell-value.red    { color: var(--red); }
.pnl-cell-value.orange { color: var(--orange); }

/* ── PROJECTS GRID ───────────────────────────────────── */
.projects-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.project-card {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--card-shadow);
  transition: box-shadow 0.2s, transform 0.2s; position: relative; overflow: hidden;
}
.project-card:hover { box-shadow: var(--card-shadow-hover); transform: translateY(-1px); }
.project-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}
.project-card.done::before        { background: var(--green); }
.project-card.in-progress::before { background: var(--orange); }
.project-card.open::before        { background: #94a3b8; }
.project-card.blocked::before     { background: var(--red); }
.project-card-name { font-family: var(--font-heading); font-size: 13px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; margin-left: 6px; }
.project-card-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.5; margin-left: 6px; margin-bottom: 12px; }
.project-card-footer { display: flex; align-items: center; margin-left: 6px; }

/* ── TODOS ───────────────────────────────────────────── */
.todo-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; border-bottom: 1px solid var(--card-border); }
.btn-add {
  display: flex; align-items: center; gap: 5px; padding: 6px 14px;
  background: var(--gradient); border: none; border-radius: 8px;
  color: white; font-size: 12px; font-weight: 600; cursor: pointer; transition: opacity 0.2s;
}
.btn-add:hover { opacity: 0.85; }
.btn-add svg { width: 13px; height: 13px; }
.todo-list { padding: 4px 0; }
.todo-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 11px 22px; border-bottom: 1px solid #F0F0F8; transition: background 0.1s;
}
.todo-item:last-child { border-bottom: none; }
.todo-item:hover { background: #FAFAFD; }
.todo-item.done .todo-text { text-decoration: line-through; color: var(--text-muted); }
.todo-check {
  width: 17px; height: 17px; border-radius: 5px; border: 2px solid var(--card-border);
  background: none; cursor: pointer; flex-shrink: 0; margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.todo-check.checked { background: var(--green); border-color: var(--green); }
.todo-check.checked::after { content: '✓'; color: white; font-size: 10px; font-weight: 700; }
.todo-content { flex: 1; }
.todo-text { font-size: 13px; color: var(--text-primary); line-height: 1.4; }
.todo-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.todo-project { font-size: 11px; color: var(--text-muted); }
.priority-badge { font-size: 10px; font-weight: 600; padding: 1px 7px; border-radius: 20px; }
.priority-high   { background: rgba(239,68,68,0.1);   color: var(--red); }
.priority-medium { background: rgba(245,158,11,0.1);  color: var(--yellow); }
.priority-low    { background: rgba(148,163,184,0.15);color: #64748b; }
.btn-delete-todo {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 14px; padding: 2px 4px; border-radius: 4px; opacity: 0; transition: opacity 0.15s;
}
.todo-item:hover .btn-delete-todo { opacity: 1; }
.btn-delete-todo:hover { color: var(--red); }

/* ── PIPELINE ────────────────────────────────────────── */
.pipeline-add-row { padding: 14px 22px; border-top: 1px solid var(--card-border); }

/* ── EMPTY STATE ─────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state-icon { font-size: 32px; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 13px; }
.loading-row td { text-align: center; padding: 36px; color: var(--text-muted); }

/* ── MODAL ───────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px); z-index: 300;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--radius-lg); box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  max-width: 500px; width: 100%; max-height: 85vh; overflow-y: auto;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px; border-bottom: 1px solid var(--card-border);
}
.modal-title { font-family: var(--font-heading); font-size: 15px; font-weight: 700; color: var(--text-primary); }
.modal-close {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 18px; line-height: 1; padding: 4px; border-radius: 6px; transition: all 0.15s;
}
.modal-close:hover { background: var(--main-bg); color: var(--text-primary); }
.modal-body { padding: 22px; }
.modal-form-group { margin-bottom: 16px; }
.modal-form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.modal-form-group input,
.modal-form-group select,
.modal-form-group textarea {
  width: 100%; background: var(--main-bg); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 10px 14px; color: var(--text-primary);
  font-family: var(--font-body); font-size: 13px; outline: none; transition: border-color 0.2s;
}
.modal-form-group input:focus,
.modal-form-group select:focus,
.modal-form-group textarea:focus { border-color: var(--orange); }
.modal-form-group textarea { resize: vertical; min-height: 72px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 22px; border-top: 1px solid var(--card-border); }
.btn-secondary {
  padding: 9px 18px; background: none; border: 1px solid var(--card-border);
  border-radius: var(--radius); color: var(--text-secondary); font-size: 13px;
  cursor: pointer; transition: all 0.15s;
}
.btn-secondary:hover { background: var(--main-bg); }
.btn-submit {
  padding: 9px 18px; background: var(--gradient); border: none;
  border-radius: var(--radius); color: white; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: opacity 0.2s;
}
.btn-submit:hover { opacity: 0.85; }

/* ── UTILITIES ───────────────────────────────────────── */
.hidden { display: none !important; }
.filter-group { display: flex; gap: 6px; }
.filter-btn {
  padding: 5px 12px; border-radius: 8px; border: 1px solid var(--card-border);
  background: none; color: var(--text-secondary); font-size: 12px; cursor: pointer; transition: all 0.15s;
}
.filter-btn:hover { background: var(--main-bg); color: var(--text-primary); }
.filter-btn.active { background: rgba(255,107,53,0.08); border-color: rgba(255,107,53,0.3); color: var(--orange); font-weight: 600; }

/* ── CRM MODAL ───────────────────────────────────────── */
.crm-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px); z-index: 300;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 24px; overflow-y: auto;
}
.crm-modal {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--radius-lg); box-shadow: 0 24px 80px rgba(0,0,0,0.18);
  width: 100%; max-width: 800px; min-height: 600px;
}
.crm-header {
  display: flex; align-items: center; gap: 16px;
  padding: 20px 24px; border-bottom: 1px solid var(--card-border);
  position: sticky; top: 0; background: var(--card-bg);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0; z-index: 1;
}
.crm-avatar {
  width: 44px; height: 44px; border-radius: 12px; background: var(--gradient);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading); font-weight: 800; font-size: 17px;
  color: white; flex-shrink: 0;
}
.crm-header-info { flex: 1; }
.crm-header-name { font-family: var(--font-heading); font-size: 18px; font-weight: 800; color: var(--text-primary); }
.crm-header-sub  { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.crm-header-badges { display: flex; gap: 6px; align-items: center; }
.crm-close {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 20px; padding: 4px 8px; border-radius: 8px; transition: all 0.15s;
  margin-left: 8px;
}
.crm-close:hover { background: var(--main-bg); color: var(--text-primary); }
.crm-body { padding: 24px; }

.crm-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.crm-section {
  background: var(--main-bg); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 16px;
}
.crm-section-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text-muted); margin-bottom: 12px;
}
.crm-field { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.crm-field:last-child { margin-bottom: 0; }
.crm-field-icon { font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.crm-field-label { font-size: 11px; color: var(--text-muted); margin-bottom: 1px; }
.crm-field-value { font-size: 13px; color: var(--text-primary); font-weight: 500; }
.crm-field-value a { color: var(--orange); text-decoration: none; }
.crm-field-value a:hover { text-decoration: underline; }

/* Cost section */
.crm-margin-bar {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--card-border); border-radius: var(--radius); overflow: hidden; margin-bottom: 16px;
}
.crm-margin-cell { background: var(--card-bg); padding: 14px 16px; }
.crm-margin-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 4px; }
.crm-margin-value { font-family: var(--font-heading); font-size: 20px; font-weight: 800; }
.crm-margin-value.green  { color: var(--green); }
.crm-margin-value.red    { color: var(--red); }
.crm-margin-value.orange { color: var(--orange); }
.crm-margin-value.purple { color: var(--purple); }

.crm-cost-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.crm-cost-item { background: var(--main-bg); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 12px; }
.crm-cost-label { font-size: 11px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.crm-cost-input {
  width: 100%; background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: 6px; padding: 6px 10px; font-size: 13px; font-weight: 600;
  color: var(--text-primary); outline: none; transition: border-color 0.2s;
}
.crm-cost-input:focus { border-color: var(--orange); }
.crm-cost-note { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.btn-save-costs {
  margin-top: 12px; padding: 8px 18px; background: var(--gradient);
  border: none; border-radius: var(--radius); color: white;
  font-size: 12px; font-weight: 600; cursor: pointer; transition: opacity 0.2s;
}
.btn-save-costs:hover { opacity: 0.85; }
.costs-saved-msg { font-size: 11px; color: var(--green); margin-left: 10px; opacity: 0; transition: opacity 0.3s; }
.costs-saved-msg.show { opacity: 1; }

/* Notes */
.crm-notes-area {
  width: 100%; background: var(--main-bg); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 12px; font-size: 13px;
  color: var(--text-primary); font-family: var(--font-body); line-height: 1.6;
  resize: vertical; min-height: 80px; outline: none; transition: border-color 0.2s;
}
.crm-notes-area:focus { border-color: var(--orange); }

/* Timeline */
.crm-timeline { margin-top: 4px; }
.timeline-entry { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid #F0F0F8; }
.timeline-entry:last-child { border-bottom: none; }
.timeline-icon-wrap { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; }
.timeline-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.tl-erstkontakt { background: rgba(59,130,246,0.1); }
.tl-gespräch    { background: rgba(114,9,183,0.1); }
.tl-angebot     { background: rgba(245,158,11,0.1); }
.tl-vertrag     { background: rgba(34,197,94,0.1); }
.tl-email       { background: rgba(255,107,53,0.1); }
.tl-notiz       { background: rgba(148,163,184,0.15); }
.tl-zahlung     { background: rgba(34,197,94,0.1); }
.tl-problem     { background: rgba(239,68,68,0.1); }
.timeline-line  { flex: 1; width: 1px; background: var(--card-border); margin-top: 4px; }
.timeline-content { flex: 1; padding-top: 4px; }
.timeline-date  { font-size: 11px; color: var(--text-muted); margin-bottom: 3px; }
.timeline-type  { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary); margin-bottom: 4px; }
.timeline-text  { font-size: 13px; color: var(--text-primary); line-height: 1.5; }
.btn-delete-tl  { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 13px; padding: 2px; border-radius: 4px; opacity: 0; transition: opacity 0.15s; margin-left: auto; align-self: flex-start; }
.timeline-entry:hover .btn-delete-tl { opacity: 1; }
.btn-delete-tl:hover { color: var(--red); }

/* Timeline add form */
.timeline-add-form { background: var(--main-bg); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 14px; margin-top: 12px; }
.timeline-add-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-bottom: 8px; align-items: end; }
.timeline-add-row select, .timeline-add-row input[type="date"] {
  background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 6px;
  padding: 7px 10px; font-size: 12px; color: var(--text-primary); outline: none;
}
.timeline-add-textarea {
  width: 100%; background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: 6px; padding: 8px 10px; font-size: 13px; color: var(--text-primary);
  font-family: var(--font-body); resize: none; height: 60px; outline: none; margin-bottom: 8px;
}
.timeline-add-textarea:focus, .timeline-add-row select:focus, .timeline-add-row input[type="date"]:focus { border-color: var(--orange); }

/* Kunden table clickable */
.kunden-row { cursor: pointer; }
.kunden-row:hover td { background: #F5F5FB !important; }
.kunden-row td:first-child { color: var(--orange); }

/* ── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .projects-grid { grid-template-columns: repeat(2, 1fr); }
  .system-grid, .two-col-grid { grid-template-columns: 1fr; }
  .pnl-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  :root { --nav-width: 0px; }
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 20px 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .projects-grid { grid-template-columns: 1fr; }
  .alert-banner { left: 0; }
}
