mitai-jinkendo/frontend/src/app.css
Lars b52c877367
All checks were successful
Deploy Development / deploy (push) Successful in 45s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 13s
feat: complete sleep module overhaul - app standard compliance
Backend improvements:
- Plausibility check: phases must sum to duration (±5 min tolerance)
- Auto-calculate wake_count from awake segments in import
- Applied to both create_sleep and update_sleep endpoints

Frontend complete rewrite:
-  Drag & Drop CSV import (like NutritionPage)
-  Inline editing (no scroll to top, edit directly in list)
-  Toast notifications (no more alerts, auto-dismiss 4s)
-  Source badges (Manual/Apple Health/Garmin with colors)
-  Expandable segment timeline view (JSONB sleep_segments)
-  Live plausibility check (shows error if phases ≠ duration)
-  Color-coded sleep phases (deep/rem/light/awake)
-  Show wake_count in list view

Design improvements:
- Stats card on top (7-day avg)
- Import drag zone with visual feedback
- Clean inline edit mode with validation
- Timeline view with phase colors
- Responsive button layout

Confirmed: Kernschlaf (Apple Health) = Leichtschlaf (light_minutes) ✓

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 13:09:34 +01:00

161 lines
6.7 KiB
CSS

:root {
--bg: #f4f3ef;
--surface: #ffffff;
--surface2: #f9f8f5;
--border: rgba(0,0,0,0.09);
--border2: rgba(0,0,0,0.16);
--text1: #1c1b18;
--text2: #5a5955;
--text3: #9a9892;
--accent: #1D9E75;
--accent-light: #E1F5EE;
--accent-dark: #0a5c43;
--danger: #D85A30;
--warn: #EF9F27;
--nav-h: 64px;
--header-h: 52px;
--font: system-ui, -apple-system, 'Segoe UI', sans-serif;
}
@media (prefers-color-scheme: dark) {
:root {
--bg: #181816; --surface: #222220; --surface2: #1e1e1c;
--border: rgba(255,255,255,0.08); --border2: rgba(255,255,255,0.14);
--text1: #eeecea; --text2: #aaa9a4; --text3: #686762;
--accent-light: #04342C; --accent-dark: #5DCAA5;
}
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body, #root { height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text1); -webkit-text-size-adjust: 100%; }
.app-shell { display: flex; flex-direction: column; height: 100%; max-width: 600px; margin: 0 auto; }
.app-header {
height: var(--header-h); display: flex; align-items: center; padding: 0 16px;
background: var(--surface); border-bottom: 1px solid var(--border);
position: sticky; top: 0; z-index: 10;
}
.app-logo { font-size: 18px; font-weight: 700; color: var(--accent); letter-spacing: -0.02em; }
.app-main { flex: 1; overflow-y: auto; padding: 16px 16px calc(var(--nav-h) + 16px); }
.bottom-nav {
position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
width: 100%; max-width: 600px;
height: var(--nav-h); display: flex; align-items: stretch;
background: var(--surface); border-top: 1px solid var(--border);
z-index: 20;
}
.nav-item {
flex: 1; display: flex; flex-direction: column; align-items: center;
justify-content: center; gap: 3px; color: var(--text3);
text-decoration: none; font-size: 10px; font-weight: 500;
transition: color 0.15s; padding-bottom: env(safe-area-inset-bottom, 0);
}
.nav-item.active { color: var(--accent); }
.nav-item svg { flex-shrink: 0; }
/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.card + .card { margin-top: 12px; }
.card-title { font-size: 13px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 10px; }
/* Stats grid */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.stat-val { font-size: 26px; font-weight: 700; color: var(--text1); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text3); margin-top: 3px; }
.stat-delta { font-size: 12px; font-weight: 600; margin-top: 4px; }
.delta-pos { color: var(--accent); }
.delta-neg { color: var(--danger); }
/* Form */
.form-section { margin-bottom: 20px; }
.form-section-title {
font-size: 13px; font-weight: 600; color: var(--text3);
text-transform: uppercase; letter-spacing: 0.05em;
margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.form-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.form-row:last-child { border-bottom: none; }
.form-label { flex: 1; font-size: 14px; color: var(--text1); }
.form-sub { font-size: 11px; color: var(--text3); display: block; margin-top: 1px; }
.form-input {
width: 90px; padding: 7px 10px; text-align: right;
font-family: var(--font); font-size: 15px; font-weight: 500; color: var(--text1);
background: var(--surface2); border: 1.5px solid var(--border2);
border-radius: 8px; transition: border-color 0.15s;
}
.form-input:focus { outline: none; border-color: var(--accent); }
.form-unit { font-size: 12px; color: var(--text3); width: 24px; }
.form-select {
font-family: var(--font); font-size: 13px; color: var(--text1);
background: var(--surface2); border: 1.5px solid var(--border2);
border-radius: 8px; padding: 7px 10px; width: 100%;
}
/* Buttons */
.btn {
display: inline-flex; align-items: center; gap: 6px;
font-family: var(--font); font-size: 14px; font-weight: 600;
padding: 10px 18px; border-radius: 10px; border: none; cursor: pointer;
transition: opacity 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: white; }
.btn-secondary { background: var(--surface2); border: 1px solid var(--border2); color: var(--text2); }
.btn-danger { background: #FCEBEB; color: var(--danger); }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; pointer-events: none; }
/* Badge */
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 4px; }
/* AI content */
.ai-content { font-size: 14px; line-height: 1.7; color: var(--text2); white-space: pre-wrap; }
.ai-content strong { color: var(--text1); font-weight: 600; }
/* Photo grid */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.photo-thumb { aspect-ratio: 1; border-radius: 8px; object-fit: cover; width: 100%; cursor: pointer; }
/* Tabs */
.tabs { display: flex; gap: 4px; background: var(--surface2); border-radius: 10px; padding: 3px; margin-bottom: 16px; }
.tab { flex: 1; text-align: center; padding: 7px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--text3); cursor: pointer; border: none; background: transparent; font-family: var(--font); }
.tab.active { background: var(--surface); color: var(--text1); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
/* Section */
.section-gap { margin-bottom: 16px; }
.page-title { font-size: 20px; font-weight: 700; margin-bottom: 16px; }
.muted { color: var(--text3); font-size: 13px; }
.empty-state { text-align: center; padding: 48px 16px; color: var(--text3); }
.empty-state h3 { font-size: 16px; color: var(--text2); margin-bottom: 6px; }
.spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideDown {
from { transform: translate(-50%, -20px); opacity: 0; }
to { transform: translate(-50%, 0); opacity: 1; }
}
/* Additional vars */
:root {
--warn-bg: #FAEEDA;
--warn-text: #7a4b08;
}
@media (prefers-color-scheme: dark) {
:root {
--warn-bg: #3a2103;
--warn-text: #FAC775;
}
}
/* 6-item nav - smaller labels */
.nav-item span { font-size: 11px; }
/* 7-item nav scrollable */
.bottom-nav { overflow-x: auto; }
.nav-item span { font-size: 11px; }
.nav-item { min-width: 60px; }
/* Header with profile avatar */
.app-header { display:flex; align-items:center; justify-content:space-between; }
.app-header a { display:flex; }