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

:root {
  --blue:       #2C5F7C;
  --blue-mid:   #4A8BA8;
  --blue-light: #B8D4E3;
  --green:      #4A8B5C;
  --green-l:    #A8C957;
  --yellow:     #F5D547;
  --gold:       #C9A04A;
  --red:        #D13438;
  --orange:     #F7B801;
  --white:      #FFFFFF;
  --gray-1:     #F4F7FA;
  --gray-2:     #E8EEF3;
  --gray-3:     #C0CDD5;
  --gray-4:     #6B7B85;
  --text:       #1A2B35;
  --radius:     14px;
  --radius-sm:  8px;
  --shadow:     0 4px 24px rgba(44,95,124,0.10);
  --shadow-lg:  0 8px 40px rgba(44,95,124,0.18);
  --font:       'DM Sans', sans-serif;
  --mono:       'DM Mono', monospace;
  --nav-h:      64px;
  --safe-b:     env(safe-area-inset-bottom, 0px);
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--gray-1);
  color: var(--text);
  min-height: 100dvh;
  overscroll-behavior: none;
}

/* ── SCREENS ── */
.screen { display: none; min-height: 100dvh; flex-direction: column; }
.screen.active { display: flex; }

/* ── LOGIN ── */
.login-wrap {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  background: linear-gradient(160deg, var(--blue) 0%, #1a3d52 100%);
}

.login-logo {
  width: 72px; height: 72px;
  background: rgba(255,255,255,0.12);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
  font-size: 32px;
}

.login-title {
  font-size: 22px; font-weight: 700; color: white;
  margin-bottom: 4px;
}
.login-sub { font-size: 14px; color: rgba(255,255,255,0.65); margin-bottom: 40px; }

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

.login-card label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--gray-4); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .04em;
}

.berater-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; margin-bottom: 20px;
}

.berater-btn {
  padding: 12px 8px;
  border: 2px solid var(--gray-2);
  border-radius: var(--radius-sm);
  background: white; cursor: pointer;
  text-align: center; transition: all .15s;
  font-family: var(--font);
}

.berater-btn:hover { border-color: var(--blue-mid); }
.berater-btn.selected { border-color: var(--blue); background: #EAF3F8; }

.berater-btn .av {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 13px;
  margin: 0 auto 6px;
}

.berater-btn .bn { font-size: 12px; font-weight: 600; color: var(--text); line-height: 1.3; }

.pin-row { display: flex; gap: 10px; margin-bottom: 20px; }
.pin-input {
  flex: 1; padding: 14px; border: 2px solid var(--gray-2);
  border-radius: var(--radius-sm); font-size: 24px; font-family: var(--mono);
  text-align: center; letter-spacing: .3em; outline: none; color: var(--blue);
  transition: border-color .15s;
}
.pin-input:focus { border-color: var(--blue); }

.btn-login {
  width: 100%; padding: 15px;
  background: var(--blue); color: white;
  border: none; border-radius: var(--radius-sm);
  font-size: 16px; font-weight: 700; font-family: var(--font);
  cursor: pointer; transition: background .15s;
}
.btn-login:hover { background: var(--blue-mid); }
.btn-login:disabled { background: var(--gray-3); cursor: not-allowed; }

.login-error {
  color: var(--red); font-size: 13px; text-align: center;
  margin-top: 12px; min-height: 20px;
}

/* ── TOPBAR ── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--blue);
  padding: 0 16px;
  height: var(--nav-h);
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.topbar-av {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}

.topbar-info { flex: 1; min-width: 0; }
.topbar-name { font-size: 15px; font-weight: 700; color: white; }
.topbar-sub  { font-size: 12px; color: rgba(255,255,255,0.65); }

.topbar-logout {
  padding: 8px 12px; background: rgba(255,255,255,0.12);
  border: none; border-radius: var(--radius-sm);
  color: white; font-size: 13px; font-family: var(--font);
  cursor: pointer;
}

/* ── BOTTOM NAV ── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: white;
  border-top: 1px solid var(--gray-2);
  display: flex;
  padding-bottom: var(--safe-b);
  box-shadow: 0 -4px 20px rgba(44,95,124,0.08);
}

.nav-item {
  flex: 1; padding: 12px 4px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  cursor: pointer; border: none; background: none; font-family: var(--font);
  color: var(--gray-4); transition: color .15s;
}
.nav-item.active { color: var(--blue); }
.nav-icon { font-size: 22px; line-height: 1; }
.nav-label { font-size: 10px; font-weight: 600; letter-spacing: .02em; }

/* ── CONTENT ── */
.content {
  flex: 1; overflow-y: auto;
  padding: 20px 16px;
  padding-bottom: calc(80px + var(--safe-b));
}

/* ── SECTION HEADER ── */
.section-hd {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.section-hd h2 { font-size: 18px; font-weight: 700; color: var(--text); }
.section-hd .meta { font-size: 13px; color: var(--gray-4); }

/* ── KW PICKER ── */
.kw-picker {
  display: flex; align-items: center; gap: 10px;
  background: white; border-radius: var(--radius); padding: 12px 16px;
  margin-bottom: 20px; box-shadow: var(--shadow);
}
.kw-center { flex: 1; text-align: center; }
.kw-val  { font-size: 18px; font-weight: 700; color: var(--blue); font-family: var(--mono); line-height: 1.2; }
.kw-range { font-size: 12px; color: var(--gray-4); margin-top: 2px; }
.kw-btn {
  width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid var(--gray-2); background: var(--gray-1);
  font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}

/* ── STATS STRIP ── */
.stats-strip {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 10px; margin-bottom: 12px;
}
.stat-card {
  background: white; border-radius: var(--radius-sm);
  padding: 12px; text-align: center;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--gray-2);
  transition: border-color .3s;
}
.stat-card.sc-gruen { border-top-color: var(--green); }
.stat-card.sc-gelb  { border-top-color: var(--orange); }
.stat-card.sc-rot   { border-top-color: var(--red); }
.stat-card .sv { font-size: 22px; font-weight: 700; color: var(--blue); font-family: var(--mono); }
.stat-card .sl { font-size: 11px; color: var(--gray-4); margin-top: 2px; }

/* ── VORWOCHE ── */
.vorwoche-card {
  background: var(--gray-1); border-radius: var(--radius-sm);
  padding: 10px 14px; margin-bottom: 12px;
  border: 1px solid var(--gray-2);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.vorwoche-label { font-size: 11px; font-weight: 700; color: var(--gray-4);
  text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.vorwoche-vals { display: flex; gap: 16px; flex-wrap: wrap; }
.vorwoche-vals span { font-size: 12px; color: var(--gray-4); }
.vorwoche-vals strong { color: var(--text); font-family: var(--mono); }

/* ── WOCHENZIEL ── */
.wochenziel-card {
  background: white; border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.wz-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.wz-label { font-size: 13px; font-weight: 600; color: var(--gray-4); }
.wz-count { font-size: 13px; font-weight: 700; color: var(--blue); font-family: var(--mono); }
.wz-bar-wrap { height: 8px; background: var(--gray-2); border-radius: 4px; overflow: hidden; display: flex; }
.wz-bar-fill { height: 100%; transition: width .5s ease, background .3s; }
.wz-bar-fill:first-child { border-radius: 4px 0 0 4px; }
.wz-bar-fill:last-child  { border-radius: 0 4px 4px 0; opacity: .45; }

/* ── TERMIN CARD ── */
.termin-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }

.termin-card {
  background: white; border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
  border-left: 4px solid var(--blue-light);
  transition: box-shadow .15s;
  position: relative;
}

.termin-card.st-durchgefuehrt { border-left-color: var(--green); }
.termin-card.st-geplant        { border-left-color: var(--blue-mid); }
.termin-card.st-verschoben     { border-left-color: var(--orange); }
.termin-card.st-abgesagt       { border-left-color: var(--red); opacity: .7; }

.termin-top { display: flex; align-items: flex-start; gap: 10px; }
.termin-name { font-size: 15px; font-weight: 700; flex: 1; }
.termin-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.termin-datum-top { font-size: 11px; color: var(--gray-4); white-space: nowrap; }
.termin-actions { display: flex; gap: 6px; }
.t-action-btn {
  width: 28px; height: 28px; border-radius: 6px;
  border: 1px solid var(--gray-2); background: var(--gray-1);
  font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}

.termin-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.badge {
  font-size: 11px; font-weight: 600; padding: 3px 8px;
  border-radius: 20px; white-space: nowrap;
}
.badge-typ-analyse  { background: #FFF4CE; color: #8A6914; }
.badge-typ-erst     { background: #DEECF9; color: #004578; }
.badge-typ-nach     { background: #DFF6DD; color: #0E5A0E; }
.badge-typ-service  { background: #EDEBE9; color: #323130; }
.badge-typ-karriere { background: #F4E5F4; color: #5C2D91; }
.badge-typ-empf     { background: #FFE2E2; color: #A4262C; }
.badge-empf         { background: #FFF0DB; color: #8A5A00; }

.badge-st-geplant       { background: #DEECF9; color: #004578; }
.badge-st-durchgefuehrt { background: #DFF6DD; color: #107C10; }
.badge-st-verschoben    { background: #FFF4CE; color: #8A6914; }
.badge-st-abgesagt      { background: #FDE7E9; color: #D13438; }

.termin-einh { font-size: 12px; color: var(--gray-4); }
.termin-datum { font-size: 12px; color: var(--gray-4); }
.termin-notiz { font-size: 12px; color: var(--gray-4); margin-top: 4px; font-style: italic; }

/* ── FAB ── */
.fab {
  position: fixed; right: 20px;
  bottom: calc(80px + var(--safe-b) + 16px);
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--blue); color: white;
  border: none; font-size: 26px;
  box-shadow: 0 4px 20px rgba(44,95,124,0.35);
  cursor: pointer; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .15s;
}
.fab:hover { background: var(--blue-mid); transform: scale(1.05); }
.fab.hidden { display: none; }

/* ── MODAL / DRAWER ── */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  z-index: 200; display: none; flex-direction: column;
  pointer-events: none;
}
.overlay.open { display: flex; }
.overlay-bg { flex: 1; cursor: pointer; pointer-events: auto; }
.drawer { pointer-events: auto; }

.drawer {
  width: 100%; background: white;
  border-radius: 20px 20px 0 0;
  padding: 20px 20px calc(24px + var(--safe-b));
  max-height: 92dvh; overflow-y: auto;
  animation: slideUp .25s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.drawer-handle {
  width: 40px; height: 4px; border-radius: 2px;
  background: var(--gray-2); margin: 0 auto 20px;
}

.drawer h3 { font-size: 18px; font-weight: 700; margin-bottom: 20px; }

/* ── FORM ── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--gray-4); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: .04em;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 12px 14px;
  border: 2px solid var(--gray-2); border-radius: var(--radius-sm);
  font-size: 15px; font-family: var(--font); color: var(--text);
  outline: none; transition: border-color .15s; background: white;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--blue); }
.form-group textarea { resize: vertical; min-height: 80px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn-save {
  width: 100%; padding: 15px;
  background: var(--blue); color: white;
  border: none; border-radius: var(--radius-sm);
  font-size: 16px; font-weight: 700; font-family: var(--font);
  cursor: pointer; margin-top: 4px;
}
.btn-save:hover { background: var(--blue-mid); }

.btn-delete {
  width: 100%; padding: 12px;
  background: none; color: var(--red);
  border: 1.5px solid var(--red); border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; font-family: var(--font);
  cursor: pointer; margin-top: 10px;
}

/* ── STATUS QUICK-SWITCH ── */
.status-switch {
  display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; margin-bottom: 16px;
}
.st-btn {
  padding: 10px; border-radius: var(--radius-sm);
  border: 2px solid var(--gray-2); background: var(--gray-1);
  font-size: 13px; font-weight: 600; font-family: var(--font);
  cursor: pointer; text-align: center; transition: all .15s;
}
.st-btn.active-geplant       { border-color: var(--blue-mid);  background: #DEECF9; color: #004578; }
.st-btn.active-durchgefuehrt { border-color: var(--green);     background: #DFF6DD; color: #107C10; }
.st-btn.active-verschoben    { border-color: var(--orange);    background: #FFF4CE; color: #8A6914; }
.st-btn.active-abgesagt      { border-color: var(--red);       background: #FDE7E9; color: var(--red); }

/* ── COCKPIT TABELLE ── */
.cockpit-table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); }
.cockpit-table {
  width: 100%; border-collapse: collapse; background: white;
}
.cockpit-table thead th {
  background: var(--blue); color: white; font-size: 11px;
  font-weight: 700; padding: 10px 12px; text-align: left;
  letter-spacing: .04em; text-transform: uppercase;
}
.cockpit-table tbody td {
  padding: 10px 12px; border-bottom: 1px solid var(--gray-2);
  font-size: 13px; vertical-align: middle;
}
.cockpit-table tbody td:first-child { display: flex; align-items: center; gap: 8px; }
.cockpit-table tbody tr:last-child td { border-bottom: none; }
.cockpit-table tfoot td {
  padding: 10px 12px; font-weight: 700; font-size: 13px;
  background: var(--gray-1); color: var(--blue);
  border-top: 2px solid var(--blue-light);
}
.cockpit-table tfoot td:first-child { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.ct-name { font-weight: 600; font-size: 13px; }
.ct-num  { font-family: var(--mono); font-weight: 700; color: var(--text); }

.cockpit-av {
  border-radius: 50%; color: white; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.cockpit-ziel-info {
  font-size: 12px; color: var(--gray-4); text-align: center;
  margin-top: 10px; padding: 8px;
}
.ampel {
  width: 14px; height: 14px; border-radius: 50%;
  flex-shrink: 0;
}
.ampel-gruen { background: var(--green); box-shadow: 0 0 8px rgba(74,139,92,0.5); }
.ampel-gelb  { background: var(--orange); box-shadow: 0 0 8px rgba(247,184,1,0.5); }
.ampel-rot   { background: var(--red); box-shadow: 0 0 8px rgba(209,52,56,0.5); }

/* ── MONAT ── */
.monat-card {
  background: white; border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.monat-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.monat-name { font-size: 14px; font-weight: 700; flex: 1; }

.progress-bar {
  height: 10px; background: var(--gray-2); border-radius: 5px; overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 5px; transition: width .4s ease;
}
.progress-fill.pct-high   { background: var(--green); }
.progress-fill.pct-mid    { background: var(--orange); }
.progress-fill.pct-low    { background: var(--red); }

.monat-pct { font-size: 13px; color: var(--gray-4); margin-top: 6px; display: flex; justify-content: space-between; }

/* ── EMPTY STATE ── */
.empty {
  text-align: center; padding: 48px 20px;
  color: var(--gray-4);
}
.empty .ei { font-size: 48px; margin-bottom: 12px; }
.empty p   { font-size: 14px; }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: calc(90px + var(--safe-b)); left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text); color: white;
  padding: 10px 20px; border-radius: 20px;
  font-size: 14px; font-weight: 500;
  opacity: 0; transition: all .3s; z-index: 300;
  white-space: nowrap; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── LOADER ── */
.loader {
  display: flex; align-items: center; justify-content: center;
  padding: 40px; color: var(--gray-4); font-size: 14px; gap: 10px;
}

@media (min-width: 480px) {
  .berater-grid { grid-template-columns: repeat(3, 1fr); }
  .stats-strip  { grid-template-columns: repeat(4, 1fr); }
}

.termin-card.st-durchgefuehrt { background: #f8fff9; }
.termin-card.st-abgesagt      { background: #fff8f8; }

/* ── HIGHLIGHT CARD ── */
.highlight-card {
  background: white; border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
  margin-top: 4px; border-left: 4px solid var(--gold);
}
.highlight-title {
  font-size: 12px; font-weight: 700; color: var(--gold);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px;
}
.highlight-empty { font-size: 13px; color: var(--gray-4); font-style: italic; }
.highlight-text  { font-size: 14px; font-weight: 600; color: var(--text); }
.highlight-datum { font-size: 12px; color: var(--gray-4); font-weight: 400; }
.highlight-edit-btn {
  margin-top: 10px; padding: 6px 14px; background: none;
  border: 1.5px solid var(--gray-3); border-radius: var(--radius-sm);
  font-size: 12px; cursor: pointer; font-family: var(--font); color: var(--gray-4);
}
.highlight-input {
  width: 100%; padding: 10px 12px;
  border: 2px solid var(--gray-2); border-radius: var(--radius-sm);
  font-size: 14px; font-family: var(--font); color: var(--text);
  outline: none;
}
.highlight-input:focus { border-color: var(--gold); }

/* ── EMPFEHLUNG CHECKBOX ── */
.empf-label {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; font-weight: 600; color: var(--text);
  cursor: pointer; text-transform: none; letter-spacing: 0;
}
.empf-check {
  width: 18px; height: 18px; accent-color: var(--gold); cursor: pointer;
}
.highlight-save-btn {
  flex: 1; padding: 9px; background: var(--gold); color: white;
  border: none; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 700; font-family: var(--font); cursor: pointer;
}
.highlight-cancel-btn {
  padding: 9px 14px; background: none; color: var(--gray-4);
  border: 1.5px solid var(--gray-3); border-radius: var(--radius-sm);
  font-size: 14px; font-family: var(--font); cursor: pointer;
}
