/* Personal Manager – Aussehen */
:root {
  --green-900: #1B2A1B;
  --green-800: #2C412C;
  --green-600: #3E7D3E;
  --accent: #E8A33D;
  --cream: #F5F1E6;
  --cream-dark: #DDD6C0;
  --border: #D9D2BC;
  --danger: #B3402F;
  --ok: #2E7D32;
  --text: #1B2A1B;
  --muted: #666;
  --radius: 8px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; height: 100%; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--cream);
  -webkit-text-size-adjust: 100%;
}
button, input, textarea { font: inherit; color: inherit; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; padding: 0 18px;
  border: 0; border-radius: 6px; cursor: pointer;
  background: var(--green-900); color: #fff; font-size: 14px; font-weight: 500;
  transition: opacity .15s;
}
.btn:hover { opacity: .85; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--green-900); color: #fff; }
.btn.accent { background: var(--accent); color: var(--green-900); }
.btn.ghost { background: var(--cream-dark); color: var(--green-900); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

/* ---------- Formulare ---------- */
.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 13px; color: #4A5A4A; margin-bottom: 4px; }
.input {
  color: var(--text);
  width: 100%; min-height: 40px; padding: 8px 10px;
  border: 1px solid #b9b39c; border-radius: 6px; background: #fff; font-size: 15px;
}
textarea.input { resize: vertical; min-height: 80px; }
.input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.input[readonly] { background: #eee; color: #555; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.with-button { display: flex; gap: 8px; align-items: center; }
.with-button .input { flex: 1; min-width: 0; }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 10px; line-height: 1.4; }
.empty { color: var(--muted); text-align: center; padding: 28px 12px; }
.sub-title { margin: 18px 0 10px; font-size: 15px; }

.msg { margin-top: 12px; padding: 10px 12px; border-radius: 6px; font-size: 14px; line-height: 1.4; }
.msg.ok { background: #E4F1E4; color: #1f5a22; }
.msg.err { background: #FBE7E4; color: #8a2d20; }

/* ---------- Anmeldeseite ---------- */
.login-page {
  min-height: 100vh; display: flex; align-items: flex-end; justify-content: center;
  padding: 24px 16px 40px;
  background: #1B2A1B url("../img/login.jpg") center top / cover no-repeat;
}
.login-card {
  width: 100%; max-width: 380px; margin-top: 180px; padding: 26px;
  border-radius: 12px; background: rgba(27, 42, 27, .82); color: #F2E8CF;
  backdrop-filter: blur(3px);
}
.login-card h2 { margin: 0 0 14px; color: #fff; font-size: 22px; }
.login-card .field-label { color: #F2E8CF; }
.login-card .btn { margin-top: 8px; }
.login-card .show-pass { margin: -4px 0 6px; font-size: 13px; }
.login-switch, .login-info { text-align: center; font-size: 13px; margin: 14px 0 0; }
.login-switch a { color: var(--accent); }

/* ---------- Seitenrahmen ---------- */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.topbar { display: none; }
.sidebar {
  background: var(--green-900); color: #fff; padding: 16px;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand { font-size: 18px; font-weight: 600; }
.welcome { margin-top: 16px; font-size: 16px; font-weight: 600; }
.role { font-size: 12px; color: #c9c2a4; margin-bottom: 18px; }
.nav { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.nav-btn {
  text-align: left; min-height: 40px; padding: 0 14px; border: 0; border-radius: 6px;
  background: var(--green-800); color: #fff; cursor: pointer; font-size: 14px;
}
.nav-btn:hover { background: #3a543a; }
.nav-btn.active { background: var(--accent); color: var(--green-900); font-weight: 600; }
.sidebar-bottom { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.content { padding: 28px 32px 60px; min-width: 0; }

.page-title { margin: 0 0 16px; font-size: 26px; font-weight: 600; }
.section-title { margin: 0 0 12px; font-size: 18px; font-weight: 600; }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.title-row .page-title { margin: 0; }

/* ---------- Karten und Listen ---------- */
.card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.cards { display: flex; flex-direction: column; gap: 12px; max-width: 860px; }
.order-head, .time-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.order-title { font-size: 17px; font-weight: 600; }
.order-line, .time-line { margin: 3px 0; line-height: 1.4; }
.order-meta { font-size: 12px; color: #888; margin-top: 6px; }
.order-card .btn-row { margin-top: 12px; }
.chip { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; background: #eee; }
.chip.offen { background: #FBE7E4; color: #8a2d20; }
.chip.inBewegung { background: #FDEBD2; color: #8a5300; }
.chip.inBearbeitung { background: #FFF3C4; color: #6b5a00; }
.chip.erledigt { background: #E4F1E4; color: #1f5a22; }
.chip.online { background: #E4F1E4; color: #1f5a22; }
.chip.offline { background: #FBE7E4; color: #8a2d20; }
.chip.forme { background: #E1EDFB; color: #1a4d8f; }
.chip.shared { background: #EDE7F6; color: #4527A0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.list-sub.tag { color: #4527A0; font-weight: 600; }
.list-sub.tag.role-hf { color: #1565C0; }
.list-sub.tag.role-ff { color: #B8860B; }
select.input { appearance: auto; }

.info-title { font-size: 17px; font-weight: 600; }
.info-text { margin-top: 10px; white-space: pre-wrap; line-height: 1.5; }

.split { display: grid; grid-template-columns: 280px 1fr; gap: 28px; align-items: start; }
.list-side > .btn { width: 100%; }
.list { margin-top: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; overflow: hidden; }
.list:empty { display: none; }
.list-item { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 6px 8px; border-bottom: 1px solid #eee; }
.list-item > .btn { flex: 0 0 auto; }
.list-item:last-child { border-bottom: 0; }
.list-item.active { background: #EAF3E6; }
.list-main {
  flex: 1 1 140px; display: flex; flex-direction: column; align-items: flex-start; text-align: left;
  padding: 6px 4px; border: 0; background: none; cursor: pointer; min-width: 0;
}
button.list-item { width: 100%; border-bottom: 1px solid #eee; }
.list button.list-item:last-child { border-bottom: 0; }
.list-name { font-weight: 600; overflow-wrap: break-word; word-break: normal; }
.list-sub { font-size: 12px; color: #777; overflow-wrap: break-word; }
.form-side { max-width: 640px; }

/* ---------- Aktivitäten ---------- */
.activity { display: grid; grid-template-columns: 110px 1fr auto; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f0ecdf; align-items: start; }
.activity:last-child { border-bottom: 0; }
.activity-time { font-size: 12px; color: #888; padding-top: 2px; }
.activity-text { line-height: 1.4; }
.check { font-size: 18px; font-weight: 700; padding-left: 8px; }
.check.rot { color: #D32F2F; }
.check.orange { color: #F57C00; }
.check.gruen { color: #2E7D32; }
.check.kreis::before { content: ""; display: block; width: 16px; height: 16px; margin: 3px 1px 0 0; border-radius: 50%; background: #2E7D32; }

.done-group { margin-bottom: 18px; }
.group-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; background: var(--cream); border-radius: 4px; padding: 6px 10px; font-weight: 600; font-size: 16px; }
.group-time { font-size: 14px; color: #4A5A4A; }
.done-total { font-weight: 600; margin: 0 0 12px; }
.done-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 4px 8px 12px; border-bottom: 1px solid #f0ecdf; }
.done-title { font-size: 14px; }
.done-details { font-size: 12px; color: #666; margin-top: 2px; }

/* ---------- Dialoge ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal { background: var(--cream); border-radius: 10px; padding: 22px; width: 100%; max-width: 460px; max-height: 92vh; overflow-y: auto; }
.modal h3 { margin: 0 0 12px; font-size: 20px; }
.modal-text { white-space: pre-line; margin: 0 0 8px; line-height: 1.4; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; margin-bottom: 14px; }
.check-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; cursor: pointer; }
.check-item input { width: 18px; height: 18px; }

/* ---------- Sprachkanal ---------- */
.voice-bar { background: var(--green-800); border-radius: var(--radius); padding: 10px; }
.voice-status { font-size: 12px; color: #F2E8CF; margin-bottom: 8px; }
.voice-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.voice-btn { min-height: 34px; padding: 0 4px; font-size: 12px; color: #fff; }
.voice-btn.on { background: var(--green-600); }
.voice-btn.off { background: var(--danger); }
.voice-page-bar { max-width: 300px; margin-bottom: 12px; }
.level { height: 8px; max-width: 300px; background: var(--cream-dark); border-radius: 4px; overflow: hidden; margin-bottom: 12px; }
.level-fill { height: 100%; width: 0; background: var(--green-600); transition: width .1s; }
.channels { display: flex; flex-direction: column; gap: 12px; max-width: 480px; margin-top: 12px; }
.channel { cursor: pointer; padding: 14px 16px; }
.channel:hover { border-color: #b9b39c; }
.channel.active { background: #EAF3E6; border: 2px solid var(--green-600); padding: 13px 15px; }
.channel-title { font-size: 17px; font-weight: 600; }
.channel-members { font-size: 13px; color: #4A5A4A; margin-top: 4px; }
.channel-speaking { font-size: 13px; font-weight: 600; color: var(--ok); margin-top: 4px; min-height: 1em; }

.version { font-size: 11px; color: #9aa79a; text-align: center; margin-top: 4px; }
.login-card .version { color: #c9c2a4; margin-top: 12px; }

/* ---------- Blinkender Menüpunkt bei neuen Informationen ---------- */
@keyframes pm-blink { 0%, 100% { background: var(--green-800); } 50% { background: #E53935; } }
@keyframes pm-blink-menu { 0%, 100% { background: transparent; } 50% { background: #E53935; } }
.nav-btn.blink { display: flex; justify-content: space-between; align-items: center; color: #fff; font-weight: 600; animation: pm-blink 1s ease-in-out infinite; }
.nav-btn.blink::after { content: "NEU"; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: #fff; color: #B3261E; }
.menu-btn.blink { border-radius: 6px; animation: pm-blink-menu 1s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  .nav-btn.blink { animation: none; background: #E53935; }
  .menu-btn.blink { animation: none; background: #E53935; }
}

/* ---------- Live Operation und Karte ---------- */
.loc-status { font-size: 12px; line-height: 1.4; color: #F2E8CF; background: var(--green-800); border-radius: var(--radius); padding: 8px 10px; }
.loc-status.sharing { color: #b7e2b9; }
.loc-status.denied, .loc-status.insecure, .loc-status.unsupported, .loc-status.unavailable { color: #ffc9c2; }

.live-layout { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
.live-map { height: calc(100vh - 200px); min-height: 420px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.live-side { display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 200px); overflow-y: auto; }
.live-summary { font-weight: 600; }
.cluster-banner { background: #FBE7E4; color: #8a2d20; border: 1px solid #E8C4BE; border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px; font-weight: 600; }
.live-card .live-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.live-line { font-size: 13px; color: #4A5A4A; margin: 2px 0; }
.live-card .btn-row { margin-top: 10px; }
.live-dot { width: 12px; height: 12px; border-radius: 50%; background: #8a8a8a; flex: none; }
.live-dot.live { background: #2E7D32; box-shadow: 0 0 0 4px rgba(46, 125, 50, .2); }
.live-dot.recent { background: #F57C00; }
.live-badge { margin-left: auto; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: #eee; color: #555; }
.live-badge.live { background: #E4F1E4; color: #1f5a22; }
.live-badge.recent { background: #FDEBD2; color: #8a5300; }

.tmap { position: relative; width: 100%; height: 100%; overflow: hidden; background: #dfe6da; touch-action: none; user-select: none; cursor: grab; }
.tmap:active { cursor: grabbing; }
.tmap-tiles, .tmap-markers { position: absolute; inset: 0; }
.tmap-markers { pointer-events: none; }
.tmap-tile { position: absolute; width: 256px; height: 256px; max-width: none; -webkit-user-drag: none; }
.tmark { position: absolute; transform: translate(-50%, -50%); }
.tmark-dot { display: block; width: 18px; height: 18px; border-radius: 50%; border: 3px solid #fff; background: #2E7D32; box-shadow: 0 1px 6px rgba(0, 0, 0, .55); }
.tmark-label { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); margin-bottom: 5px; white-space: nowrap; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: #fff; color: var(--green-900); box-shadow: 0 1px 4px rgba(0, 0, 0, .4); }
.tmark.dest .tmark-dot { width: 14px; height: 14px; border-radius: 3px; background: #E8A33D; transform: rotate(45deg); }
.tmark.dest .tmark-label { background: #FFF3DC; font-weight: 600; margin-bottom: 8px; }
.tmap-controls { position: absolute; z-index: 3; top: 10px; left: 10px; display: flex; flex-direction: column; gap: 6px; }
.tmap-btn { width: 36px; height: 36px; padding: 0; border: 0; border-radius: 6px; background: #fff; color: var(--green-900); font-size: 20px; font-weight: 700; cursor: pointer; box-shadow: 0 1px 6px rgba(0, 0, 0, .4); }
.tmap-btn:hover { background: var(--accent); }
.tmap-attr { position: absolute; z-index: 3; right: 0; bottom: 0; padding: 1px 6px; font-size: 11px; background: rgba(255, 255, 255, .85); }

/* ---------- Fläche auf der Karte festlegen ---------- */
.pick-overlay { position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; background: var(--cream); }
.pick-panel { flex: none; max-height: 55vh; overflow-y: auto; padding: 10px 14px 8px; background: #fff; border-bottom: 1px solid var(--border); }
.pick-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pick-head h3 { margin: 0; font-size: 18px; }
.pick-close { min-height: 40px; padding: 0 16px; border: 0; border-radius: 20px; background: var(--cream-dark); color: var(--green-900); font-weight: 700; cursor: pointer; }
.pick-close:hover { background: var(--accent); }
.pick-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; margin-top: 8px; }
.pick-fields .field { margin-bottom: 8px; }
.pick-steps { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0; }
.pick-step { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border: 2px solid var(--border); border-radius: 10px; background: #fff; text-align: left; cursor: pointer; }
.pick-step.active { border-color: var(--accent); background: #FFF8EA; }
.pick-num { flex: none; width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: #999; color: #fff; font-weight: 700; }
.pick-step.done .pick-num { background: var(--ok); }
.pick-coord { display: block; font-size: 12px; color: #666; }
.pick-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pick-search { display: flex; gap: 8px; flex: 1; min-width: 220px; }
.pick-hint { font-size: 13px; color: #4A5A4A; margin: 8px 0 2px; }
.pick-map { flex: 1; min-height: 0; position: relative; }
.pick-map .tmap { cursor: crosshair; }
.pick-actions { flex: none; display: flex; flex-wrap: wrap; gap: 10px; padding: 10px 14px; background: #fff; border-top: 1px solid var(--border); }

.danger-zone { margin-top: 44px; padding-top: 18px; border-top: 2px solid #E8C4BE; max-width: 640px; }
.danger-zone .section-title { color: var(--danger); }
.delete-list { margin: 0 0 12px; padding-left: 20px; line-height: 1.6; }

.keep-status { font-size: 12px; line-height: 1.4; color: #F2E8CF; background: var(--green-800); border-radius: var(--radius); padding: 8px 10px; }
.keep-status .check-item { padding: 0; font-size: 13px; }
.keep-status .check-item input { width: 16px; height: 16px; }
.keep-text { margin-top: 4px; }
.keep-status.wakelock .keep-text, .keep-status.video .keep-text { color: #b7e2b9; }
.keep-status.video-wait .keep-text { color: #ffe0a3; }

/* ---------- Karte (Google Maps) über der ganzen Seite ---------- */
.map-overlay { position: fixed; inset: 0; z-index: 1000; background: #E9E5DC; }
.map-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #4A5A4A; font-size: 16px; }
.map-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.map-close {
  position: absolute; z-index: 2; top: calc(env(safe-area-inset-top, 0px) + 10px); right: 10px;
  min-height: 44px; padding: 0 18px; border: 0; border-radius: 22px;
  background: #fff; color: var(--green-900); font-size: 15px; font-weight: 700; cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .45);
}
.map-close:hover { background: var(--accent); }

/* ---------- Handy ---------- */
@media (max-width: 820px) {
  .shell { display: block; }
  .topbar {
    display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 20;
    background: var(--green-900); color: #fff; padding: 8px 12px;
  }
  .topbar .brand { font-size: 17px; font-weight: 600; }
  .menu-btn { background: none; border: 0; color: #fff; font-size: 26px; line-height: 1; padding: 4px 8px; cursor: pointer; }
  .sidebar {
    position: fixed; z-index: 30; top: 0; left: 0; bottom: 0; width: 280px; max-width: 86vw;
    transform: translateX(-105%); transition: transform .2s; height: auto;
  }
  .shell.open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .5); }
  .content { padding: 18px 14px 60px; }
  .page-title { font-size: 22px; }
  .split { grid-template-columns: 1fr; gap: 18px; }
  .live-layout { grid-template-columns: 1fr; }
  .pick-fields { grid-template-columns: 1fr; }
  .pick-panel { max-height: 50vh; }
  .live-map { height: 55vh; min-height: 320px; }
  .live-side { max-height: none; }
  .grid2 { grid-template-columns: 1fr; }
  .activity { grid-template-columns: 1fr auto; }
  .activity-time { grid-column: 1 / -1; }
  .checks { grid-template-columns: 1fr; }
  /* Am Handy: Bild oben in voller Breite, Anmeldung darunter */
  .login-page { background-size: 100% auto; background-position: top center; align-items: flex-start; padding-top: 0; }
  .login-card { margin-top: calc(56.25vw + 8px); }
  .btn-row .btn { flex: 1 1 auto; }
}
