:root {
  --bordeaux: #850034;
  --bordeaux-dark: #5c0025;
  --bordeaux-light: #a3004a;
  --bordeaux-soft: rgba(133,0,52,0.08);
  --bordeaux-softer: rgba(133,0,52,0.04);
  --bg: #ffffff;
  --surface: #f8f6f4;
  --surface-2: #f0edea;
  --border: #e5e0db;
  --text: #333333;
  --text-muted: #888888;
  --text-dark: #1a1a1a;
  --green: #2e8b57;
  --green-soft: rgba(46,139,87,0.08);
  --red: #c0392b;
  --red-soft: rgba(192,57,43,0.08);
  --blue: #2c6fbb;
  --blue-soft: rgba(44,111,187,0.08);
  --amber: #c17b1e;
  --amber-soft: rgba(193,123,30,0.08);
  --radius: 12px;
  --header-h: 56px;
  --tabbar-h: 64px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow: hidden;
  height: 100dvh;
  width: 100vw;
}

h1, h2, h3, h4 { font-family: 'Jost', sans-serif; color: var(--text-dark); }

/* APP HEADER */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  background: var(--bordeaux);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 10px;
  z-index: 100;
}

.header-logo {
  width: 28px;
  height: 28px;
  filter: brightness(0) invert(1);
}

.header-title {
  font-family: 'Jost', sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  flex: 1;
}

.header-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: background 0.2s;
}

.header-btn:hover { background: rgba(255,255,255,0.1); }

/* SCREENS */
.screen {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  bottom: var(--tabbar-h);
  overflow-y: auto;
  overflow-x: hidden;
  display: none;
  -webkit-overflow-scrolling: touch;
}

.screen.active { display: block; }

.screen-content {
  padding: 16px;
  padding-bottom: 24px;
}

.screen-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 16px;
}

/* TAB BAR */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--tabbar-h);
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: 'Jost', sans-serif;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s;
}

.tab.active { color: var(--bordeaux); }
.tab svg { transition: color 0.2s; }
.tab.active svg { stroke: var(--bordeaux); }

/* SEARCH */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 12px;
}

.search-bar svg { color: var(--text-muted); flex-shrink: 0; }

.search-bar input {
  flex: 1;
  border: none;
  background: none;
  font-family: 'Open Sans', sans-serif;
  font-size: 15px;
  color: var(--text);
  outline: none;
}

.search-bar input::placeholder { color: var(--text-muted); }

/* WG TABS */
.wg-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.wg-tabs::-webkit-scrollbar { display: none; }

.wg-tab {
  font-family: 'Jost', sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.wg-tab.active {
  background: var(--bordeaux);
  color: #fff;
  border-color: var(--bordeaux);
}

/* RESIDENT LIST */
.resident-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.resident-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.resident-card:hover, .resident-card:active {
  border-color: var(--bordeaux);
  box-shadow: 0 2px 8px rgba(133,0,52,0.08);
}

.resident-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bordeaux-soft);
  color: var(--bordeaux);
  font-family: 'Jost', sans-serif;
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.resident-info { flex: 1; min-width: 0; }

.resident-name {
  font-family: 'Jost', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark);
}

.resident-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.resident-arrow {
  color: var(--text-muted);
  flex-shrink: 0;
}

/* BACK BUTTON */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--bordeaux);
  font-family: 'Jost', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 0;
  margin-bottom: 16px;
}

/* RECORD SCREEN */
.record-resident {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 24px;
}

.record-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bordeaux);
  color: #fff;
  font-family: 'Jost', sans-serif;
  font-weight: 700;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.record-name {
  font-family: 'Jost', sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-dark);
}

.record-wg {
  font-size: 13px;
  color: var(--text-muted);
}

/* RECORD AREA */
.record-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 0;
}

.record-timer {
  font-family: 'Jost', sans-serif;
  font-size: 48px;
  font-weight: 300;
  color: var(--text-dark);
  margin-bottom: 20px;
  letter-spacing: 2px;
}

.record-wave {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 48px;
  margin-bottom: 16px;
  opacity: 0;
  transition: opacity 0.3s;
}

.record-wave.active { opacity: 1; }

.wave-bar {
  width: 4px;
  height: 8px;
  background: var(--bordeaux);
  border-radius: 2px;
  transition: height 0.1s;
}

.record-wave.active .wave-bar {
  animation: wave 0.6s ease-in-out infinite alternate;
}

.record-wave.active .wave-bar:nth-child(1) { animation-delay: 0s; }
.record-wave.active .wave-bar:nth-child(2) { animation-delay: 0.05s; }
.record-wave.active .wave-bar:nth-child(3) { animation-delay: 0.1s; }
.record-wave.active .wave-bar:nth-child(4) { animation-delay: 0.15s; }
.record-wave.active .wave-bar:nth-child(5) { animation-delay: 0.2s; }
.record-wave.active .wave-bar:nth-child(6) { animation-delay: 0.25s; }
.record-wave.active .wave-bar:nth-child(7) { animation-delay: 0.3s; }
.record-wave.active .wave-bar:nth-child(8) { animation-delay: 0.25s; }
.record-wave.active .wave-bar:nth-child(9) { animation-delay: 0.2s; }
.record-wave.active .wave-bar:nth-child(10) { animation-delay: 0.15s; }
.record-wave.active .wave-bar:nth-child(11) { animation-delay: 0.1s; }
.record-wave.active .wave-bar:nth-child(12) { animation-delay: 0.05s; }
.record-wave.active .wave-bar:nth-child(13) { animation-delay: 0.1s; }
.record-wave.active .wave-bar:nth-child(14) { animation-delay: 0.15s; }
.record-wave.active .wave-bar:nth-child(15) { animation-delay: 0.2s; }

@keyframes wave {
  0% { height: 8px; }
  100% { height: 40px; }
}

.record-hint {
  font-family: 'Jost', sans-serif;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
  transition: opacity 0.3s;
}

.record-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid var(--bordeaux);
  background: var(--bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  position: relative;
}

.record-btn:hover { box-shadow: 0 0 0 8px rgba(133,0,52,0.08); }

.record-btn.recording {
  border-color: var(--red);
  background: var(--red);
}

.record-btn.recording .record-btn-inner { color: #fff; }

.record-btn-inner {
  color: var(--bordeaux);
  display: flex;
  align-items: center;
  justify-content: center;
}

.record-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  width: 100%;
  max-width: 320px;
}

/* ACTION BUTTONS */
.action-btn {
  flex: 1;
  font-family: 'Jost', sans-serif;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.action-btn.discard {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.action-btn.discard:hover { background: var(--red-soft); color: var(--red); }

.action-btn.process {
  background: var(--bordeaux);
  color: #fff;
}

.action-btn.process:hover { background: var(--bordeaux-dark); }

.action-btn.secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

/* CATEGORY CHIPS */
.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
  justify-content: center;
}

.chip {
  font-family: 'Jost', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.chip.active {
  background: var(--bordeaux-soft);
  color: var(--bordeaux);
  border-color: var(--bordeaux);
}

/* RESULT SCREEN */
.result-header { margin-bottom: 20px; }
.result-header h2 { font-size: 22px; margin-bottom: 4px; }

.result-meta {
  font-size: 13px;
  color: var(--text-muted);
}

.result-section { margin-bottom: 20px; }

.result-label {
  font-family: 'Jost', sans-serif;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--bordeaux);
  margin-bottom: 8px;
}

.result-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 14px;
  line-height: 1.8;
  min-height: 60px;
}

.result-structured {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 60px;
}

.struct-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.struct-label {
  font-family: 'Jost', sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.struct-label.vital { color: var(--blue); }
.struct-label.bericht { color: var(--bordeaux); }
.struct-label.massnahme { color: var(--green); }
.struct-label.trinken { color: var(--amber); }

.struct-value {
  font-size: 14px;
  color: var(--text-dark);
  font-weight: 600;
}

.struct-text {
  font-size: 14px;
  color: var(--text);
  line-height: 1.7;
}

.result-actions {
  display: flex;
  gap: 12px;
  padding: 16px 0;
}

/* HISTORY */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-card {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.history-name {
  font-family: 'Jost', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
}

.history-time {
  font-size: 12px;
  color: var(--text-muted);
}

.history-preview {
  font-size: 13px;
  color: var(--text);
  margin-top: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.history-badge {
  display: inline-block;
  font-family: 'Jost', sans-serif;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 6px;
}

.history-badge.synced { background: var(--green-soft); color: var(--green); }
.history-badge.pending { background: var(--amber-soft); color: var(--amber); }

/* LOADING */
.loading-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 16px;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bordeaux);
  opacity: 0.3;
  animation: dots 1.2s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dots {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  font-size: 14px;
}

/* UTILITY */
.hidden { display: none !important; }

/* DEMO HINT */
.demo-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--blue-soft);
  border: 1px solid rgba(44,111,187,0.15);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--blue);
}

.demo-hint .info-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-family: 'Jost', sans-serif;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
</style>
