/* ─── VOLTEO BUSINESS – Global Styles ─────────────────────────────────────── */
:root {
  --brand-dark:  #0f2b46;
  --brand-green: #14805e;
  --brand-light: #e8f4f0;
  --bg:          #f5f7fa;
  --white:       #ffffff;
  --border:      #d1d9e0;
  --text:        #1a2a3a;
  --text-muted:  #6b7a8d;
  --danger:      #c0392b;
  --warning:     #e67e22;
  --success:     #27ae60;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.10);
  --shadow-md:   0 4px 12px rgba(0,0,0,.12);
  --radius:      6px;
  --radius-lg:   10px;
}

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

html { font-size: 15px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ─── HEADER ─────────────────────────────────────────────────────────────── */
.app-header {
  background: var(--brand-dark);
  color: #fff;
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.app-header .logo {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: .03em;
  white-space: nowrap;
  color: #fff;
  text-decoration: none;
}

.app-header .logo span { color: #4dd9a8; }

.app-header nav { display: flex; gap: .25rem; flex: 1; }

.app-header nav a {
  color: rgba(255,255,255,.75);
  text-decoration: none;
  padding: .35rem .75rem;
  border-radius: var(--radius);
  font-size: .9rem;
  transition: background .15s, color .15s;
}

.app-header nav a:hover,
.app-header nav a.active {
  background: rgba(255,255,255,.12);
  color: #fff;
}

.app-header .user-info {
  font-size: .82rem;
  color: rgba(255,255,255,.65);
  white-space: nowrap;
}

.app-header .user-info strong { color: #fff; }

.btn-logout {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff;
  padding: .3rem .75rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .82rem;
  transition: background .15s;
}

.btn-logout:hover { background: rgba(255,255,255,.2); }

/* ─── LAYOUT ─────────────────────────────────────────────────────────────── */
.page-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--brand-dark);
  margin-bottom: 1.25rem;
}

/* ─── CARDS ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

/* ─── DASHBOARD TILES ────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-tile {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-sm);
}

.kpi-tile .kpi-label {
  font-size: .78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .35rem;
}

.kpi-tile .kpi-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--brand-dark);
  line-height: 1;
}

.kpi-tile .kpi-value.green { color: var(--brand-green); }

/* ─── BUTTONS ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem 1rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: .88rem;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s, opacity .15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--brand-green);
  color: #fff;
}
.btn-primary:hover { background: #0f6a4d; }

.btn-secondary {
  background: var(--brand-dark);
  color: #fff;
}
.btn-secondary:hover { background: #0a1e33; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { background: var(--bg); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #a93226; }

.btn-sm {
  padding: .3rem .65rem;
  font-size: .8rem;
}

.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ─── FORMS ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }

.form-group label {
  display: block;
  font-size: .83rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: .35rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.form-control {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .92rem;
  background: var(--white);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--brand-green);
  box-shadow: 0 0 0 3px rgba(20,128,94,.12);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0 1.25rem;
}

.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.form-actions {
  display: flex;
  gap: .75rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

/* ─── TABLES ─────────────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}

thead th {
  text-align: left;
  padding: .65rem .9rem;
  background: var(--bg);
  color: var(--text-muted);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }

tbody td {
  padding: .65rem .9rem;
  vertical-align: middle;
}

tbody td a { color: var(--brand-green); text-decoration: none; font-weight: 500; }
tbody td a:hover { text-decoration: underline; }

/* ─── BADGES ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .03em;
}

.badge-lead          { background: #eaf0fb; color: #2d5fb2; }
.badge-vollmacht_offen { background: #fff3cd; color: #856404; }
.badge-aktiv         { background: #d4edda; color: #155724; }
.badge-gekuendigt    { background: #f8d7da; color: #721c24; }

.badge-mit    { background: #d4edda; color: #155724; }
.badge-ohne   { background: #e9ecef; color: #495057; }

/* ─── ALERTS ─────────────────────────────────────────────────────────────── */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: .88rem;
}

.alert-error   { background: #fde8e8; color: var(--danger); border: 1px solid #f5c6c6; }
.alert-success { background: #d4edda; color: #155724;      border: 1px solid #c3e6cb; }
.alert-info    { background: #d1ecf1; color: #0c5460;      border: 1px solid #bee5eb; }

/* ─── SEARCH / FILTER BAR ────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  gap: .75rem;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.toolbar .search-input {
  flex: 1;
  min-width: 200px;
  padding: .45rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .88rem;
}

.toolbar select {
  padding: .45rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .88rem;
  background: var(--white);
}

/* ─── MODAL ──────────────────────────────────────────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-backdrop.open { display: flex; }

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  position: relative;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--brand-dark);
  margin-bottom: 1.1rem;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-muted);
}

/* ─── SECTION ────────────────────────────────────────────────────────────── */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .85rem;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--brand-dark);
}

/* ─── LOGIN PAGE ─────────────────────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-dark);
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2rem 2.25rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-md);
}

.login-logo {
  text-align: center;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--brand-dark);
  margin-bottom: 1.5rem;
  letter-spacing: .04em;
}

.login-logo span { color: var(--brand-green); }

/* ─── UTILITIES ──────────────────────────────────────────────────────────── */
.text-muted  { color: var(--text-muted); }
.text-right  { text-align: right; }
.mt-1        { margin-top: .5rem; }
.mt-2        { margin-top: 1rem; }
.mt-3        { margin-top: 1.5rem; }
.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; }
.hidden      { display: none !important; }
.w-full      { width: 100%; }

/* ─── RESPONSIVE ─────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .app-header nav a { padding: .3rem .5rem; font-size: .82rem; }
}
