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

:root{
  --bg: #10141a;
  --surface: #1a2029;
  --surface-2: #222a35;
  --line: #2b3542;
  --text: #e9edf2;
  --text-muted: #8794a3;
  --teal: #49c9bd;
  --teal-dim: rgba(73,201,189,0.14);
  --amber: #f0a35e;
  --amber-dim: rgba(240,163,94,0.14);
  --red: #eb6d61;
  --red-dim: rgba(235,109,97,0.12);
  --green: #6bcf8f;
  --green-dim: rgba(107,207,143,0.14);
}
*{box-sizing:border-box; -webkit-tap-highlight-color: transparent;}
html,body{margin:0; padding:0; background:var(--bg); font-family:'Inter',sans-serif; color:var(--text); min-height:100vh;}

.screen{ display:none; flex-direction:column; min-height:100vh; max-width:520px; margin:0 auto; position:relative; }
.screen.active{ display:flex; }

/* ---------- PIN SCREEN ---------- */
#pin{ align-items:center; justify-content:space-between; padding:0 0 36px; background:
  radial-gradient(120% 60% at 50% 0%, #161c25 0%, var(--bg) 60%); }
.pin-top{ display:flex; flex-direction:column; align-items:center; margin-top:64px; gap:8px;}
.pin-mark{ width:46px; height:46px; border-radius:13px; background:var(--teal-dim); display:flex; align-items:center; justify-content:center; margin-bottom:6px;}
.pin-mark svg{ width:22px; height:22px; stroke:var(--teal); }
.pin-title{ font-family:'Manrope',sans-serif; font-weight:800; font-size:20px; letter-spacing:0.2px;}
.pin-sub{ font-size:13px; color:var(--text-muted);}
.pin-error{ font-size:12.5px; color:var(--red); font-weight:600; min-height:16px; margin-top:10px;}
.dots{ display:flex; gap:16px; margin:34px 0 0;}
.dot{ width:14px; height:14px; border-radius:50%; border:1.5px solid var(--line); transition: all .15s;}
.dot.filled{ background:var(--teal); border-color:var(--teal); box-shadow:0 0 0 5px var(--teal-dim);}
.keypad{ display:grid; grid-template-columns:repeat(3,1fr); gap:6px; width:100%; padding:0 34px; max-width:340px;}
.key{ height:64px; border-radius:20px; background:transparent; border:none; color:var(--text); font-size:22px; font-family:'Manrope',sans-serif; font-weight:700; display:flex; align-items:center; justify-content:center;}
.key:active{ background:var(--surface-2); }
.key.ghost{ visibility:hidden; }
.key.del{ font-size:14px; color:var(--text-muted); font-weight:600; font-family:'Inter';}

/* ---------- HOME SCREEN ---------- */
.topbar{ padding:30px 22px 20px;}
.date-line{ font-size:11.5px; color:var(--teal); letter-spacing:1.2px; text-transform:uppercase; font-weight:700;}
.title-row{ display:flex; justify-content:space-between; align-items:center; gap:14px; margin-top:6px;}
.h1{ font-family:'Manrope',sans-serif; font-weight:800; font-size:25px; margin:0; letter-spacing:-0.3px; cursor:default;}
.topbar-actions{ display:flex; gap:8px; flex-shrink:0;}
.lock-btn{ position:relative; width:34px; height:34px; border-radius:50%; background:transparent; border:none; display:flex; align-items:center; justify-content:center; cursor:pointer; flex-shrink:0;}
.lock-btn:active{ background:var(--surface);}
.lock-btn svg{ width:15px; height:15px; stroke:var(--text-muted);}
.status-row{ display:flex; align-items:center; gap:8px; margin-top:18px; padding-top:16px; border-top:1px solid var(--line);}
.status-row svg{ width:16px; height:16px; stroke:var(--amber); flex-shrink:0;}
.status-row .txt{ font-size:13.5px; color:var(--text-muted); font-weight:600;}
.status-row .txt b{ color:var(--amber); font-weight:700;}

.modal-backdrop{ position:fixed; inset:0; background:rgba(5,7,10,0.6); display:flex; align-items:center; justify-content:center; z-index:100; padding:24px;}
.modal-backdrop.sheet-backdrop{ align-items:flex-end; justify-content:center; padding:0;}
.modal-card{ width:100%; max-width:320px; background:var(--surface); border:1px solid var(--line); border-radius:18px; padding:18px; display:flex; flex-direction:column; gap:10px;}
.modal-head{ display:flex; align-items:center; justify-content:space-between;}
.modal-title{ font-family:'Manrope',sans-serif; font-weight:800; font-size:15px;}

.tabs{ display:flex; gap:6px; margin:0 22px 18px; background:var(--surface); padding:4px; border-radius:12px;}
.tab{ flex:1; text-align:center; padding:9px 0; border-radius:9px; font-size:13px; font-weight:600; color:var(--text-muted); cursor:pointer;}
.tab.active{ background:var(--surface-2); color:var(--text);}

.list{ flex:1; overflow-y:auto; padding:0 20px 100px;}

.empty-hint{ color:var(--text-muted); font-size:13.5px; text-align:center; margin-top:60px;}

.item{ display:flex; align-items:flex-start; gap:8px; margin-bottom:16px;}
.item .datebadge{ flex-shrink:0; width:34px; padding-top:3px; text-align:right; font-size:10px; color:var(--text-muted); line-height:1.3; font-weight:600;}
.item .datebadge b{ display:block; font-size:15px; color:var(--text); font-family:'Manrope',sans-serif;}
.item.past .datebadge b{ color:var(--text-muted);}
.item .timeline-col{ position:relative; flex-shrink:0; width:14px; display:flex; justify-content:center;}
.item .node{ position:relative; z-index:2; margin-top:5px; width:14px; height:14px; border-radius:50%; background:var(--bg); border:2px solid var(--teal); box-sizing:border-box;}
.item.past .node{ border-color:var(--line); }
.item .timeline-col::after{ content:''; position:absolute; top:19px; bottom:-16px; left:50%; width:2px; background:var(--line); transform:translateX(-50%);}

.card{ flex:1; min-width:0; background:var(--surface); border:1px solid var(--line); border-radius:16px; padding:14px 16px; cursor:pointer;}
.item.past .card{ opacity:0.55;}
.card-top{ display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:6px;}
.tag{ font-size:10.5px; font-weight:700; padding:3px 8px; border-radius:7px; letter-spacing:0.3px; text-transform:uppercase; white-space:nowrap;}
.tag.teal{ background:var(--teal-dim); color:var(--teal);}
.tag.amber{ background:var(--amber-dim); color:var(--amber);}
.countdown{ font-size:11.5px; color:var(--text-muted); font-weight:600; white-space:nowrap;}
.card-title{ font-family:'Manrope',sans-serif; font-weight:700; font-size:15.5px; margin-bottom:2px;}
.card-meta{ font-size:12.5px; color:var(--text-muted); display:flex; gap:10px; align-items:center;}
.card-meta span{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0;}

.conflict-strip{ margin-top:7px; display:inline-flex; align-items:center; gap:4px; max-width:100%; background:var(--red-dim); border:1px solid rgba(235,109,97,0.35); color:#f0958c; border-radius:7px; padding:3px 8px; font-size:10.5px; font-weight:600;}
.conflict-strip.mild{ background:var(--amber-dim); border-color:rgba(240,163,94,0.35); color:var(--amber);}
.conflict-strip svg{ width:11px; height:11px; flex-shrink:0;}
.conflict-strip span{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}

.import-file-chip{ display:flex; align-items:center; gap:10px; background:var(--surface-2); border:1px solid var(--line); border-radius:12px; padding:10px 12px; margin-top:10px;}
.import-file-chip .doc{ width:28px; height:28px; border-radius:8px; background:var(--teal-dim); display:flex; align-items:center; justify-content:center; flex-shrink:0;}
.import-file-chip .doc svg{ width:14px; height:14px; stroke:var(--teal);}
.import-file-chip .meta{ flex:1; min-width:0;}
.import-file-chip .fn{ font-size:12px; font-weight:600; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.import-file-chip .dt{ font-size:10.5px; color:var(--text-muted); margin-top:1px;}
.import-file-chip .x{ width:24px; height:24px; border-radius:7px; background:rgba(235,109,97,0.14); display:flex; align-items:center; justify-content:center; flex-shrink:0; color:#f0958c; font-size:12px; font-weight:700; cursor:pointer;}

.cron-url{ font-family:monospace; font-size:11px; background:var(--surface); border:1px solid var(--line); border-radius:8px; padding:8px 10px; word-break:break-all; color:var(--text-muted); user-select:all;}

.section-label{ font-size:11px; text-transform:uppercase; letter-spacing:1px; color:var(--text-muted); font-weight:700; margin:4px 0 12px 64px;}

.fab{ position:fixed; right:calc(22px + (100vw - min(100vw,520px))/2); bottom:28px; width:56px; height:56px; border-radius:18px; background:var(--teal); display:flex; align-items:center; justify-content:center; box-shadow:0 10px 24px -6px rgba(73,201,189,0.5); z-index:20; cursor:pointer;}
.fab svg{ width:24px; height:24px; stroke:#0b1512; stroke-width:2.4;}

/* ---------- ADD SCREEN ---------- */
#add{ padding:0;}
.sheet-head{ display:flex; align-items:center; justify-content:space-between; padding:22px 20px 16px;}
.sheet-head .h2{ font-family:'Manrope'; font-weight:800; font-size:18px;}
.close-btn{ width:30px; height:30px; border-radius:9px; background:var(--surface); display:flex; align-items:center; justify-content:center; color:var(--text-muted); font-size:14px; cursor:pointer;}
.form{ flex:1; overflow-y:auto; padding:0 20px 40px; display:flex; flex-direction:column; gap:16px;}
.field label{ display:block; font-size:11.5px; text-transform:uppercase; letter-spacing:0.6px; color:var(--text-muted); font-weight:700; margin-bottom:7px;}
.input{ width:100%; background:var(--surface); border:1px solid var(--line); border-radius:12px; padding:12px 14px; color:var(--text); font-size:14.5px; font-family:'Inter';}
textarea.input{ resize:vertical; line-height:1.4; min-height:70px;}
.row2{ display:flex; gap:12px;}
.row2 .field{ flex:1;}
.chipset{ display:flex; gap:10px; flex-wrap:wrap;}
.chip{ padding:8px 13px; border-radius:10px; background:var(--surface); border:1px solid var(--line); font-size:13px; font-weight:600; color:var(--text-muted); cursor:pointer;
  user-select:none; -webkit-user-select:none; -webkit-touch-callout:none;}
.chip.sel{ background:var(--teal-dim); border-color:var(--teal); color:var(--teal);}
.chip.plus{ border-style:dashed; color:var(--text-muted);}
.reminder-row{ display:flex; align-items:center; gap:8px; background:var(--surface); border:1px solid var(--line); border-radius:12px; padding:10px 12px;}
.reminder-row span{ flex:1; font-size:13.5px;}
.reminder-row button{ background:none; border:none; color:var(--text-muted); font-size:16px; cursor:pointer;}
.reminder-add-row{ display:flex; gap:8px; align-items:center;}
.reminder-add-row select.input{ flex:1;}
.reminder-add-row .chip{ flex-shrink:0; white-space:nowrap;}
.add-reminder{ display:flex; align-items:center; gap:6px; color:var(--teal); font-size:13.5px; font-weight:700; padding:8px 2px; cursor:pointer;}
.add-reminder svg{ width:14px; height:14px; stroke:var(--teal);}
.save-btn{ margin-top:6px; background:var(--teal); color:#0b1512; text-align:center; padding:15px; border-radius:14px; font-weight:800; font-family:'Manrope'; font-size:15px; border:none; cursor:pointer;}
.delete-btn{ background:transparent; color:var(--red); text-align:center; padding:12px; border-radius:14px; font-weight:700; font-family:'Manrope'; font-size:14px; border:1px solid rgba(235,109,97,0.35); cursor:pointer;}
.field-hint{ font-size:11px; color:var(--text-muted); margin:10px 0 0;}
.inline-add{ display:flex; gap:8px; align-items:center; margin-top:10px;}
.inline-add .input{ flex:1;}

.stacked-add-form{ display:flex; flex-direction:column; gap:12px;}
.stacked-add-bottom{ display:flex; gap:8px; align-items:center;}

/* ---------- Ort/Notiz-Erkennung ---------- */
.quote-box{ background:var(--surface-2); border-left:3px solid var(--teal); border-radius:0 10px 10px 0; padding:10px 12px; display:flex; flex-direction:column; gap:8px;}
.card .quote-box{ margin-top:9px;}
.quote-line{ display:flex; align-items:center; gap:8px; font-size:12.5px; min-width:0;}
.quote-line svg{ width:14px; height:14px; stroke:var(--teal); flex-shrink:0;}
.quote-line a{ color:var(--teal); text-decoration:none; font-weight:600;}
.quote-line .plain{ color:var(--text); overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.minimap{ margin-top:2px; display:flex; flex-direction:column; gap:12px;}
.minimap .map-frame{ border-radius:8px; overflow:hidden; border:1px solid var(--line); background:var(--surface);}
.minimap iframe{ display:block; width:100%; height:150px; border:0; pointer-events:none;}
.minimap .route-link{ align-self:flex-start; background:var(--teal-dim); color:var(--teal); font-size:11.5px; font-weight:700; padding:7px 12px; border-radius:8px; display:flex; align-items:center; gap:5px; text-decoration:none;}
.minimap .route-link svg{ width:11px; height:11px; stroke:var(--teal);}
.map-actions{ display:flex; justify-content:space-between; gap:10px;}
.map-btn{ flex:1; text-align:center; padding:10px 12px; border-radius:10px; font-size:12.5px; font-weight:700; text-decoration:none; white-space:nowrap; background:var(--surface-2); color:var(--text); border:1px solid var(--line);}
.map-btn.primary{ background:var(--teal); color:#0b1512; border-color:var(--teal);}

.detect-hint{ font-size:10.5px; color:var(--text-muted); margin:8px 0 0; display:flex; align-items:center; gap:5px;}
.detect-hint svg{ width:11px; height:11px; stroke:var(--teal);}

.ort-such-row{ display:flex; flex-direction:column; gap:2px; background:var(--surface); border:1px solid var(--line); border-radius:10px; padding:10px 12px; cursor:pointer;}
.ort-such-row .n{ font-weight:700; font-size:13px;}
.ort-such-row .a{ font-size:11.5px; color:var(--text-muted);}

/* ---------- RHYTHMUS SCREEN ---------- */
.rhy-section{ display:flex; flex-direction:column; gap:10px; background:var(--surface); border:1px solid var(--line); border-radius:16px; padding:16px;}
.rhy-section-title{ font-family:'Manrope',sans-serif; font-weight:800; font-size:15px;}
.rhy-section-title-row{ display:flex; align-items:center; justify-content:space-between; cursor:pointer;}
.rhy-chevron{ width:16px; height:16px; stroke:var(--text-muted); transition:transform .15s; flex-shrink:0;}
.rhy-chevron.open{ transform:rotate(180deg);}
.rhy-collapsible{ display:flex; flex-direction:column; gap:10px;}
.rhy-collapsible.collapsed{ display:none;}
.rhy-hint{ font-size:12px; color:var(--text-muted); margin:0;}
.rhy-list{ display:flex; flex-direction:column; gap:8px;}
.rhy-row{ display:flex; align-items:center; gap:8px; background:var(--surface-2); border:1px solid var(--line); border-radius:12px; padding:10px 12px; font-size:13px;}
.rhy-row .rhy-main{ flex:1;}
.rhy-row .rhy-main b{ font-family:'Manrope',sans-serif;}
.rhy-row .rhy-sub{ color:var(--text-muted); font-size:11.5px; margin-top:2px;}
.rhy-row button{ background:none; border:none; color:var(--text-muted); font-size:15px; cursor:pointer;}
.rhy-add-row{ display:flex; gap:8px; flex-wrap:wrap; align-items:center;}
.rhy-add-row select.input{ appearance:none;}
.block-row{ display:flex; gap:8px; align-items:center;}
.block-row select{ flex:1;}
.block-row input{ width:80px;}
.rhy-section .input, .rhy-section select.input{ background:var(--surface-2);}
.rhy-section .chip{ background:var(--surface-2);}
.rhy-section .chip.sel{ background:var(--teal-dim);}

/* ---------- Sections-Trenner (Zu erledigen / Termine) ---------- */
.section-divider{ display:flex; align-items:center; gap:10px; margin:6px 22px 14px;}
.section-divider span{ font-size:11.5px; font-weight:700; letter-spacing:0.8px; text-transform:uppercase; color:var(--text-muted); white-space:nowrap;}
.section-divider .line{ flex:1; height:1px; background:var(--line);}
.section-divider .add-mini{ width:22px; height:22px; border-radius:7px; background:var(--surface); border:1px solid var(--line); display:flex; align-items:center; justify-content:center; color:var(--teal); font-weight:700; font-size:14px; cursor:pointer; flex-shrink:0;}

/* ---------- Login-Versuche (versteckt, im Push-Modal) ---------- */
.login-log{ display:flex; flex-direction:column; gap:8px; margin-top:10px; max-height:220px; overflow-y:auto;}
.login-log-row{ display:flex; justify-content:space-between; align-items:center; gap:10px; background:var(--surface-2); border:1px solid var(--line); border-radius:10px; padding:9px 12px; font-size:12.5px;}
.login-log-row .zeit{ color:var(--text-muted);}
.login-log-row .ip{ color:var(--text); font-weight:600;}
.login-log-status{ font-size:11px; font-weight:700; padding:3px 9px; border-radius:20px; flex-shrink:0;}
.login-log-status.ok{ background:var(--green-dim); color:var(--green);}
.login-log-status.falsch{ background:var(--amber-dim); color:var(--amber);}
.login-log-status.gesperrt{ background:var(--red-dim); color:var(--red);}

/* ---------- Aufgaben (Zu erledigen) ---------- */
.aufgaben-wrap{ padding:0 22px; margin-bottom:6px;}
.task-list{ display:flex; flex-direction:column; gap:8px;}
.task{ display:flex; align-items:center; gap:12px; background:var(--surface); border:1px solid var(--line); border-left:4px solid var(--red); border-radius:12px; padding:12px 14px; cursor:pointer;}
.task.amber{ border-left-color:var(--amber);}
.task.green{ border-left-color:var(--green);}
.task-dot{ width:11px; height:11px; border-radius:50%; background:var(--red); flex-shrink:0;}
.task.amber .task-dot{ background:var(--amber);}
.task.green .task-dot{ background:var(--green);}
.task-body{ flex:1; min-width:0;}
.task-title{ font-family:'Manrope',sans-serif; font-weight:700; font-size:14.5px;}
.task-sub{ font-size:12px; color:var(--text-muted); margin-top:2px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.task-badge{ font-size:11px; font-weight:700; padding:4px 10px; border-radius:20px; background:var(--red-dim); color:var(--red); white-space:nowrap; flex-shrink:0;}
.task.amber .task-badge{ background:var(--amber-dim); color:var(--amber);}
.task.green .task-badge{ background:var(--green-dim); color:var(--green);}

/* ---------- Ganztägig/Dauer im Formular ---------- */
#dauerRow.disabled{ opacity:0.4; pointer-events:none;}

/* ---------- Termin-Detail-Modal ---------- */
.detail-sheet{ width:100%; max-width:520px; max-height:88vh; overflow-y:auto; background:var(--surface); border-top-left-radius:22px; border-top-right-radius:22px; border:1px solid var(--line); border-bottom:none; padding:8px 20px 28px; margin-top:auto;}
.detail-handle{ width:40px; height:4px; border-radius:2px; background:var(--line); margin:8px auto 14px;}
.detail-sheet .modal-head{ align-items:flex-start; margin-bottom:6px;}
.detail-title{ font-family:'Manrope',sans-serif; font-weight:800; font-size:19px; margin-top:6px;}

.countdown-box{ background:var(--surface-2); border:1px solid var(--line); border-radius:14px; padding:14px 16px; display:flex; justify-content:space-between; align-items:center; margin:14px 0 18px;}
.countdown-num{ font-family:'Manrope',sans-serif; font-weight:800; font-size:24px; color:var(--teal); line-height:1;}
.countdown-label{ font-size:12px; color:var(--text-muted); margin-top:3px;}
.countdown-date{ font-size:13px; color:var(--text-muted); text-align:right; line-height:1.5;}

#detailMapWrap:not(:empty){ margin-top:16px;}
#detailParkNotizWrap{ margin-top:16px;}
.info-row{ display:flex; gap:12px; padding:11px 0; border-bottom:1px solid var(--line); font-size:14px;}
.info-row:last-child{ border-bottom:none;}
.info-row .info-icon{ width:18px; text-align:center; color:var(--text-muted); flex-shrink:0; padding-top:1px;}
.info-row .info-icon svg{ width:16px; height:16px; stroke:var(--text-muted);}
.info-row .info-label{ font-size:11px; text-transform:uppercase; letter-spacing:0.4px; color:var(--text-muted); font-weight:700; margin-bottom:3px;}
.info-row .info-value{ color:var(--text);}
.info-row a.info-value{ color:var(--teal); text-decoration:none; font-weight:600;}
.info-row .info-value.pre{ white-space:pre-line;}

.accordion{ margin-top:16px;}
.accordion-head{ display:flex; justify-content:space-between; align-items:center; padding:13px 14px; background:var(--surface-2); border:1px solid var(--line); border-radius:12px; font-size:13.5px; font-weight:700; cursor:pointer;}
.accordion-body{ padding-top:14px;}
.accordion-body.collapsed{ display:none;}
