Files
homeschool-dashboard/frontend/src/views/AdminView.vue
T
derekcandClaude Sonnet 4.6 87315b8902 Add break time feature to schedule blocks
- Admin: per-block "Break Time" checkbox + duration (min) setting; new
  Break Activities section (global list, same pattern as Morning Routine)
- Dashboard: break timer section appears on blocks with break enabled;
  Start/Pause/Resume/Reset controls work independently of the main timer
- TV: left column switches to amber break badge + countdown during break;
  center column shows configurable Break Activities list
- Backend: break_time_enabled/break_time_minutes columns on schedule_blocks
  (auto-migrated on startup); break_activity_items table + CRUD router;
  break timer events (break_start/pause/resume/reset) stored as TimerEvents
  and broadcast via WebSocket; break_activities included in dashboard
  snapshot and session_update broadcast

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-03-03 08:40:49 -08:00

943 lines
34 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div class="page">
<NavBar />
<main class="container">
<h1>Admin</h1>
<!-- Children section -->
<section class="section">
<div class="section-header">
<h2>Children</h2>
<button class="btn-primary btn-sm" @click="showChildForm = !showChildForm">+ Add</button>
</div>
<form v-if="showChildForm" @submit.prevent="createChild" class="inline-form">
<input v-model="newChild.name" placeholder="Name" required />
<input v-model="newChild.color" type="color" title="Color" />
<button type="submit" class="btn-primary btn-sm">Save</button>
<button type="button" class="btn-sm" @click="showChildForm = false">Cancel</button>
</form>
<div class="item-list">
<div v-for="child in childrenStore.children" :key="child.id" class="item-row">
<template v-if="editingChild && editingChild.id === child.id">
<input v-model="editingChild.name" class="edit-input" required />
<input v-model="editingChild.color" type="color" title="Color" />
<div class="item-actions">
<button class="btn-sm btn-primary" @click="saveChild">Save</button>
<button class="btn-sm" @click="editingChild = null">Cancel</button>
</div>
</template>
<template v-else>
<div class="item-color" :style="{ background: child.color }"></div>
<span class="item-name">{{ child.name }}</span>
<span class="item-meta">{{ child.is_active ? 'Active' : 'Inactive' }}</span>
<div class="item-actions">
<button class="btn-sm" @click="startEditChild(child)">Edit</button>
<button class="btn-sm" @click="toggleChild(child)">
{{ child.is_active ? 'Deactivate' : 'Activate' }}
</button>
<button class="btn-sm btn-danger" @click="deleteChild(child.id)">Delete</button>
</div>
</template>
</div>
<div v-if="childrenStore.children.length === 0" class="empty-small">No children added yet.</div>
</div>
</section>
<!-- Subjects section -->
<section class="section">
<div class="section-header">
<h2>Subjects</h2>
<button class="btn-primary btn-sm" @click="showSubjectForm = !showSubjectForm">+ Add</button>
</div>
<form v-if="showSubjectForm" @submit.prevent="createSubject" class="inline-form">
<input v-model="newSubject.name" placeholder="Subject name" required />
<input v-model="newSubject.icon" placeholder="Icon (emoji)" maxlength="4" style="width:60px" />
<input v-model="newSubject.color" type="color" title="Color" />
<button type="submit" class="btn-primary btn-sm">Save</button>
<button type="button" class="btn-sm" @click="showSubjectForm = false">Cancel</button>
</form>
<div class="item-list">
<div v-for="subject in subjects" :key="subject.id" class="subject-block">
<!-- Subject row -->
<div class="item-row">
<template v-if="editingSubject && editingSubject.id === subject.id">
<input v-model="editingSubject.name" class="edit-input" required />
<input v-model="editingSubject.icon" placeholder="Icon" maxlength="4" style="width:60px" class="edit-input" />
<input v-model="editingSubject.color" type="color" title="Color" />
<div class="item-actions">
<button class="btn-sm btn-primary" @click="saveSubject">Save</button>
<button class="btn-sm" @click="editingSubject = null">Cancel</button>
</div>
</template>
<template v-else>
<div class="item-color" :style="{ background: subject.color }"></div>
<span class="item-icon">{{ subject.icon }}</span>
<span class="item-name">{{ subject.name }}</span>
<div class="item-actions">
<button class="btn-sm" @click="startEditSubject(subject)">Edit</button>
<button
class="btn-sm"
@click="expandedSubject = expandedSubject === subject.id ? null : subject.id"
>{{ expandedSubject === subject.id ? 'Hide Options' : 'Options' }}</button>
<button class="btn-sm btn-danger" @click="deleteSubject(subject.id)">Delete</button>
</div>
</template>
</div>
<!-- Options panel -->
<div v-if="expandedSubject === subject.id" class="options-panel">
<div class="option-list">
<template v-for="opt in subject.options" :key="opt.id">
<div v-if="editingOption && editingOption.id === opt.id" class="option-edit-row">
<input v-model="editingOption.text" class="option-input" @keyup.enter="saveOption(subject.id)" />
<button class="btn-sm btn-primary" @click="saveOption(subject.id)">Save</button>
<button class="btn-sm" @click="editingOption = null">Cancel</button>
</div>
<div v-else class="option-row">
<span class="option-text">{{ opt.text }}</span>
<div class="item-actions">
<button class="btn-sm" @click="startEditOption(opt)">Edit</button>
<button class="btn-sm btn-danger" @click="deleteOption(subject.id, opt.id)">✕</button>
</div>
</div>
</template>
<div v-if="subject.options.length === 0" class="empty-small">No options yet.</div>
</div>
<form class="option-add-row" @submit.prevent="addOption(subject.id)">
<input v-model="newOptionText" placeholder="Add an option..." class="option-input" required />
<button type="submit" class="btn-primary btn-sm">Add</button>
</form>
</div>
</div>
<div v-if="subjects.length === 0" class="empty-small">No subjects added yet.</div>
</div>
</section>
<!-- Morning Routine section -->
<section class="section">
<div class="section-header">
<h2>Morning Routine</h2>
</div>
<div class="card">
<p class="routine-hint">These items appear in the Activities panel on the TV during the "Good Morning" countdown before the first block starts.</p>
<div class="option-list">
<template v-for="item in morningRoutine" :key="item.id">
<div v-if="editingRoutineItem && editingRoutineItem.id === item.id" class="option-edit-row">
<input v-model="editingRoutineItem.text" class="option-input" @keyup.enter="saveRoutineItem" />
<button class="btn-sm btn-primary" @click="saveRoutineItem">Save</button>
<button class="btn-sm" @click="editingRoutineItem = null">Cancel</button>
</div>
<div v-else class="option-row">
<span class="option-text">{{ item.text }}</span>
<div class="item-actions">
<button class="btn-sm" @click="startEditRoutineItem(item)">Edit</button>
<button class="btn-sm btn-danger" @click="deleteRoutineItem(item.id)">✕</button>
</div>
</div>
</template>
<div v-if="morningRoutine.length === 0" class="empty-small">No items yet.</div>
</div>
<form class="option-add-row" style="margin-top: 0.75rem" @submit.prevent="addRoutineItem">
<input v-model="newRoutineText" placeholder="Add a morning routine item..." class="option-input" required />
<button type="submit" class="btn-primary btn-sm">Add</button>
</form>
</div>
</section>
<!-- Break Activities section -->
<section class="section">
<div class="section-header">
<h2>Break Activities</h2>
</div>
<div class="card">
<p class="routine-hint">These items appear in the Activities panel on the TV during break time.</p>
<div class="option-list">
<template v-for="item in breakActivities" :key="item.id">
<div v-if="editingBreakItem && editingBreakItem.id === item.id" class="option-edit-row">
<input v-model="editingBreakItem.text" class="option-input" @keyup.enter="saveBreakItem" />
<button class="btn-sm btn-primary" @click="saveBreakItem">Save</button>
<button class="btn-sm" @click="editingBreakItem = null">Cancel</button>
</div>
<div v-else class="option-row">
<span class="option-text">{{ item.text }}</span>
<div class="item-actions">
<button class="btn-sm" @click="startEditBreakItem(item)">Edit</button>
<button class="btn-sm btn-danger" @click="deleteBreakItem(item.id)">✕</button>
</div>
</div>
</template>
<div v-if="breakActivities.length === 0" class="empty-small">No items yet.</div>
</div>
<form class="option-add-row" style="margin-top: 0.75rem" @submit.prevent="addBreakItem">
<input v-model="newBreakText" placeholder="Add a break activity..." class="option-input" required />
<button type="submit" class="btn-primary btn-sm">Add</button>
</form>
</div>
</section>
<!-- Schedules section -->
<section class="section">
<div class="section-header">
<h2>Schedules</h2>
<button class="btn-primary btn-sm" @click="showCreateForm = !showCreateForm">+ New Template</button>
</div>
<!-- Create form -->
<div class="card" v-if="showCreateForm">
<h3>New Schedule Template</h3>
<form @submit.prevent="createTemplate">
<div class="field">
<label>Template Name</label>
<input v-model="newTemplate.name" placeholder="e.g. Monday Schedule" required />
</div>
<div class="field">
<label>Child (optional — leave blank for all children)</label>
<select v-model="newTemplate.child_id">
<option :value="null">All children</option>
<option v-for="c in childrenStore.children" :key="c.id" :value="c.id">{{ c.name }}</option>
</select>
</div>
<div class="form-actions">
<button type="button" class="btn-sm" @click="showCreateForm = false">Cancel</button>
<button type="submit" class="btn-primary btn-sm">Create</button>
</div>
</form>
</div>
<!-- Template list -->
<div class="template-list">
<div v-for="template in templates" :key="template.id" class="template-card">
<div class="template-header">
<div>
<div class="template-name">{{ template.name }}</div>
<div class="template-child">
{{ template.child_id ? childName(template.child_id) : 'All children' }}
· {{ template.blocks.length }} blocks
</div>
</div>
<div class="template-actions">
<button class="btn-sm" @click="editingTemplate = editingTemplate === template.id ? null : template.id">
{{ editingTemplate === template.id ? 'Close' : 'Edit Blocks' }}
</button>
<button class="btn-sm btn-danger" @click="deleteTemplate(template.id)">Delete</button>
</div>
</div>
<!-- Block editor -->
<div v-if="editingTemplate === template.id" class="block-editor">
<!-- Day hours -->
<div class="day-hours-row">
<span class="day-hours-label">School day hours</span>
<input
type="time"
:value="template.day_start_time ? template.day_start_time.slice(0,5) : ''"
@change="e => saveDayHours(template, 'start', e.target.value)"
placeholder="Start"
/>
<span class="day-hours-sep">to</span>
<input
type="time"
:value="template.day_end_time ? template.day_end_time.slice(0,5) : ''"
@change="e => saveDayHours(template, 'end', e.target.value)"
placeholder="End"
/>
</div>
<div class="block-list">
<template v-for="block in sortedBlocks(template.blocks)" :key="block.id">
<!-- Edit mode -->
<form
v-if="editingBlock && editingBlock.id === block.id"
class="edit-block-form"
@submit.prevent="saveBlock(template.id)"
>
<select v-model="editingBlock.subject_id">
<option :value="null">No subject</option>
<option v-for="s in subjects" :key="s.id" :value="s.id">{{ s.icon }} {{ s.name }}</option>
</select>
<input v-model="editingBlock.time_start" type="time" required />
<span>to</span>
<input v-model="editingBlock.time_end" type="time" required />
<input
v-model.number="editingBlock.duration_minutes"
type="number" min="1" max="480"
placeholder="Duration (min)"
style="width:130px"
/>
<input v-model="editingBlock.label" placeholder="Label (optional)" />
<label class="break-check-label">
<input type="checkbox" v-model="editingBlock.break_time_enabled" />
Break
</label>
<input
v-if="editingBlock.break_time_enabled"
v-model.number="editingBlock.break_time_minutes"
type="number" min="1" max="120"
placeholder="Break (min)"
style="width:100px"
/>
<button type="submit" class="btn-sm btn-primary">Save</button>
<button type="button" class="btn-sm" @click="editingBlock = null">Cancel</button>
</form>
<!-- Display mode -->
<div v-else class="block-row">
<span class="block-time">{{ formatTime(block.time_start) }} – {{ formatTime(block.time_end) }}</span>
<span class="block-label">{{ block.label || subjectName(block.subject_id) || 'Unnamed' }}</span>
<span class="block-duration" :class="{ 'block-duration-custom': block.duration_minutes != null }">
{{ blockDurationLabel(block) }}
</span>
<span v-if="block.break_time_enabled" class="break-badge">
☕ {{ block.break_time_minutes ? `${block.break_time_minutes}min` : '' }} break
</span>
<button class="btn-sm" @click="startEditBlock(block)">Edit</button>
<button class="btn-sm btn-danger" @click="deleteBlock(template.id, block.id)">✕</button>
</div>
</template>
<div v-if="template.blocks.length === 0" class="empty-small">No blocks yet.</div>
</div>
<!-- Add block form -->
<form @submit.prevent="addBlock(template.id)" class="add-block-form">
<select v-model="newBlock.subject_id">
<option :value="null">No subject</option>
<option v-for="s in subjects" :key="s.id" :value="s.id">{{ s.icon }} {{ s.name }}</option>
</select>
<input v-model="newBlock.time_start" type="time" required />
<span>to</span>
<input v-model="newBlock.time_end" type="time" required />
<input
v-model.number="newBlock.duration_minutes"
type="number" min="1" max="480"
placeholder="Duration (min)"
style="width:130px"
/>
<input v-model="newBlock.label" placeholder="Label (optional)" />
<label class="break-check-label">
<input type="checkbox" v-model="newBlock.break_time_enabled" />
Break
</label>
<input
v-if="newBlock.break_time_enabled"
v-model.number="newBlock.break_time_minutes"
type="number" min="1" max="120"
placeholder="Break (min)"
style="width:100px"
/>
<button type="submit" class="btn-primary btn-sm">Add Block</button>
</form>
</div>
</div>
<div v-if="templates.length === 0 && !showCreateForm" class="empty-small">
No schedule templates yet. Create one to get started.
</div>
</div>
</section>
<!-- Settings section -->
<section class="section">
<div class="section-header">
<h2>Settings</h2>
</div>
<div class="settings-card">
<div class="settings-row">
<div class="settings-label">
<div class="settings-title">Timezone</div>
<div class="settings-hint">Times in the activity log will display in this timezone.</div>
</div>
<div class="settings-control">
<select v-model="selectedTimezone" class="tz-select">
<option v-for="tz in TIMEZONES" :key="tz.value" :value="tz.value">
{{ tz.label }}
</option>
</select>
<button class="btn-primary btn-sm" @click="saveTimezone" :disabled="tzSaved">
{{ tzSaved ? 'Saved!' : 'Save' }}
</button>
</div>
</div>
</div>
</section>
</main>
</div>
</template>
<script setup>
import { ref, onMounted } from 'vue'
import { useChildrenStore } from '@/stores/children'
import { useAuthStore } from '@/stores/auth'
import api from '@/composables/useApi'
import NavBar from '@/components/NavBar.vue'
import { TIMEZONES } from '@/utils/time'
const childrenStore = useChildrenStore()
const authStore = useAuthStore()
const subjects = ref([])
// Settings — Timezone
const selectedTimezone = ref(authStore.timezone)
const tzSaved = ref(false)
async function saveTimezone() {
await api.patch('/api/users/me', { timezone: selectedTimezone.value })
await authStore.fetchMe()
localStorage.setItem('tz', selectedTimezone.value)
tzSaved.value = true
setTimeout(() => { tzSaved.value = false }, 2000)
}
// Children
const showChildForm = ref(false)
const newChild = ref({ name: '', color: '#4F46E5' })
const editingChild = ref(null)
async function createChild() {
await childrenStore.createChild(newChild.value)
newChild.value = { name: '', color: '#4F46E5' }
showChildForm.value = false
}
function startEditChild(child) {
editingChild.value = { ...child }
showChildForm.value = false
}
async function saveChild() {
await childrenStore.updateChild(editingChild.value.id, {
name: editingChild.value.name,
color: editingChild.value.color,
})
editingChild.value = null
}
async function toggleChild(child) {
await childrenStore.updateChild(child.id, { is_active: !child.is_active })
}
async function deleteChild(id) {
if (confirm('Delete this child? All associated data will be removed.')) {
await childrenStore.deleteChild(id)
}
}
// Subjects
const showSubjectForm = ref(false)
const newSubject = ref({ name: '', icon: '📚', color: '#10B981' })
const editingSubject = ref(null)
const expandedSubject = ref(null)
// Subject options
const newOptionText = ref('')
const editingOption = ref(null)
async function loadSubjects() {
const res = await api.get('/api/subjects')
subjects.value = res.data
}
function startEditSubject(subject) {
editingSubject.value = { ...subject }
showSubjectForm.value = false
}
async function saveSubject() {
const res = await api.patch(`/api/subjects/${editingSubject.value.id}`, {
name: editingSubject.value.name,
icon: editingSubject.value.icon,
color: editingSubject.value.color,
})
const idx = subjects.value.findIndex((s) => s.id === editingSubject.value.id)
if (idx !== -1) subjects.value[idx] = res.data
editingSubject.value = null
}
async function createSubject() {
const res = await api.post('/api/subjects', newSubject.value)
subjects.value.push(res.data)
newSubject.value = { name: '', icon: '📚', color: '#10B981' }
showSubjectForm.value = false
}
async function deleteSubject(id) {
if (confirm('Delete this subject?')) {
await api.delete(`/api/subjects/${id}`)
subjects.value = subjects.value.filter((s) => s.id !== id)
}
}
async function addOption(subjectId) {
await api.post(`/api/subjects/${subjectId}/options`, {
text: newOptionText.value,
order_index: subjects.value.find(s => s.id === subjectId)?.options.length || 0,
})
newOptionText.value = ''
await loadSubjects()
}
function startEditOption(opt) {
editingOption.value = { id: opt.id, text: opt.text }
}
async function saveOption(subjectId) {
await api.patch(`/api/subjects/${subjectId}/options/${editingOption.value.id}`, {
text: editingOption.value.text,
})
editingOption.value = null
await loadSubjects()
}
async function deleteOption(subjectId, optionId) {
await api.delete(`/api/subjects/${subjectId}/options/${optionId}`)
await loadSubjects()
}
// Morning Routine
const morningRoutine = ref([])
const newRoutineText = ref('')
const editingRoutineItem = ref(null)
async function loadMorningRoutine() {
const res = await api.get('/api/morning-routine')
morningRoutine.value = res.data
}
async function addRoutineItem() {
await api.post('/api/morning-routine', {
text: newRoutineText.value,
order_index: morningRoutine.value.length,
})
newRoutineText.value = ''
await loadMorningRoutine()
}
function startEditRoutineItem(item) {
editingRoutineItem.value = { ...item }
}
async function saveRoutineItem() {
await api.patch(`/api/morning-routine/${editingRoutineItem.value.id}`, {
text: editingRoutineItem.value.text,
})
editingRoutineItem.value = null
await loadMorningRoutine()
}
async function deleteRoutineItem(id) {
await api.delete(`/api/morning-routine/${id}`)
await loadMorningRoutine()
}
// Break Activities
const breakActivities = ref([])
const newBreakText = ref('')
const editingBreakItem = ref(null)
async function loadBreakActivities() {
const res = await api.get('/api/break-activities')
breakActivities.value = res.data
}
async function addBreakItem() {
await api.post('/api/break-activities', {
text: newBreakText.value,
order_index: breakActivities.value.length,
})
newBreakText.value = ''
await loadBreakActivities()
}
function startEditBreakItem(item) {
editingBreakItem.value = { ...item }
}
async function saveBreakItem() {
await api.patch(`/api/break-activities/${editingBreakItem.value.id}`, {
text: editingBreakItem.value.text,
})
editingBreakItem.value = null
await loadBreakActivities()
}
async function deleteBreakItem(id) {
await api.delete(`/api/break-activities/${id}`)
await loadBreakActivities()
}
// Schedules
const templates = ref([])
const showCreateForm = ref(false)
const editingTemplate = ref(null)
const newTemplate = ref({ name: '', child_id: null, is_default: false })
const newBlock = ref({ subject_id: null, time_start: '', time_end: '', duration_minutes: null, label: '', order_index: 0, break_time_enabled: false, break_time_minutes: null })
const editingBlock = ref(null)
function childName(id) {
return childrenStore.children.find((c) => c.id === id)?.name || 'Unknown'
}
function subjectName(id) {
return subjects.value.find((s) => s.id === id)?.name || null
}
function formatTime(str) {
if (!str) return ''
const [h, m] = str.split(':').map(Number)
const period = h >= 12 ? 'PM' : 'AM'
const hour = h % 12 || 12
return `${hour}:${String(m).padStart(2, '0')} ${period}`
}
function sortedBlocks(blocks) {
const toMin = (t) => { if (!t) return 0; const [h, m] = t.split(':').map(Number); return h * 60 + m }
return (blocks || []).slice().sort((a, b) => toMin(a.time_start) - toMin(b.time_start))
}
function blockDurationLabel(block) {
if (block.duration_minutes != null) return `${block.duration_minutes} min`
if (block.time_start && block.time_end) {
const [sh, sm] = block.time_start.split(':').map(Number)
const [eh, em] = block.time_end.split(':').map(Number)
const mins = (eh * 60 + em) - (sh * 60 + sm)
if (mins > 0) return `${mins} min`
}
return ''
}
async function loadTemplates() {
const res = await api.get('/api/schedules')
templates.value = res.data
}
async function createTemplate() {
await api.post('/api/schedules', newTemplate.value)
newTemplate.value = { name: '', child_id: null, is_default: false }
showCreateForm.value = false
await loadTemplates()
}
async function deleteTemplate(id) {
if (confirm('Delete this template and all its blocks?')) {
await api.delete(`/api/schedules/${id}`)
await loadTemplates()
}
}
async function addBlock(templateId) {
const payload = {
...newBlock.value,
order_index: templates.value.find((t) => t.id === templateId)?.blocks.length || 0,
}
await api.post(`/api/schedules/${templateId}/blocks`, payload)
newBlock.value = { subject_id: null, time_start: '', time_end: '', duration_minutes: null, label: '', order_index: 0, break_time_enabled: false, break_time_minutes: null }
await loadTemplates()
}
function startEditBlock(block) {
editingBlock.value = {
id: block.id,
subject_id: block.subject_id,
time_start: block.time_start ? block.time_start.slice(0, 5) : '',
time_end: block.time_end ? block.time_end.slice(0, 5) : '',
duration_minutes: block.duration_minutes ?? null,
label: block.label || '',
break_time_enabled: block.break_time_enabled || false,
break_time_minutes: block.break_time_minutes ?? null,
}
}
async function saveBlock(templateId) {
const { id, ...payload } = editingBlock.value
await api.patch(`/api/schedules/${templateId}/blocks/${id}`, payload)
editingBlock.value = null
await loadTemplates()
}
async function deleteBlock(templateId, blockId) {
await api.delete(`/api/schedules/${templateId}/blocks/${blockId}`)
await loadTemplates()
}
async function saveDayHours(template, which, value) {
const payload = which === 'start'
? { day_start_time: value || null }
: { day_end_time: value || null }
await api.patch(`/api/schedules/${template.id}`, payload)
await loadTemplates()
}
onMounted(async () => {
await childrenStore.fetchChildren()
await Promise.all([loadSubjects(), loadTemplates(), loadMorningRoutine(), loadBreakActivities()])
selectedTimezone.value = authStore.timezone
})
</script>
<style scoped>
.page { min-height: 100vh; background: #0f172a; }
.container { max-width: 900px; margin: 0 auto; padding: 2rem; }
h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: 2rem; }
.section { margin-bottom: 3rem; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
h2 { font-size: 1.1rem; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.05em; }
.inline-form {
display: flex;
align-items: center;
gap: 0.5rem;
background: #1e293b;
padding: 1rem;
border-radius: 0.75rem;
margin-bottom: 1rem;
flex-wrap: wrap;
}
.inline-form input[type="text"],
.inline-form input:not([type="color"]) {
padding: 0.5rem 0.75rem;
background: #0f172a;
border: 1px solid #334155;
border-radius: 0.5rem;
color: #f1f5f9;
font-size: 0.9rem;
flex: 1;
min-width: 120px;
}
.item-list { display: flex; flex-direction: column; gap: 0.5rem; }
.item-row {
display: flex;
align-items: center;
gap: 0.75rem;
background: #1e293b;
padding: 0.75rem 1rem;
border-radius: 0.75rem;
}
.item-color { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.item-icon { font-size: 1.2rem; }
.item-name { flex: 1; font-weight: 500; }
.item-meta { font-size: 0.8rem; color: #64748b; }
.item-actions { display: flex; gap: 0.4rem; }
.edit-input {
padding: 0.35rem 0.6rem;
background: #0f172a;
border: 1px solid #4f46e5;
border-radius: 0.5rem;
color: #f1f5f9;
font-size: 0.9rem;
flex: 1;
min-width: 100px;
}
/* Schedule styles */
.card { background: #1e293b; border-radius: 1rem; padding: 1.5rem; margin-bottom: 1.5rem; }
.card h3 { margin-bottom: 1.25rem; }
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 0.85rem; color: #94a3b8; margin-bottom: 0.4rem; }
.field input, .field select {
width: 100%;
padding: 0.65rem 0.9rem;
background: #0f172a;
border: 1px solid #334155;
border-radius: 0.5rem;
color: #f1f5f9;
font-size: 0.9rem;
}
.form-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 0.5rem; }
.template-list { display: flex; flex-direction: column; gap: 1rem; }
.template-card { background: #1e293b; border-radius: 1rem; padding: 1.25rem; }
.template-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.template-name { font-size: 1.05rem; font-weight: 600; }
.template-child { font-size: 0.8rem; color: #64748b; margin-top: 0.2rem; }
.template-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }
.block-editor { margin-top: 1.25rem; border-top: 1px solid #334155; padding-top: 1.25rem; }
.day-hours-row {
display: flex;
align-items: center;
gap: 0.6rem;
margin-bottom: 1rem;
background: #0f172a;
padding: 0.6rem 0.85rem;
border-radius: 0.5rem;
}
.day-hours-label { font-size: 0.8rem; color: #64748b; flex: 1; }
.day-hours-sep { font-size: 0.8rem; color: #475569; }
.day-hours-row input[type="time"] {
padding: 0.35rem 0.5rem;
background: #1e293b;
border: 1px solid #334155;
border-radius: 0.4rem;
color: #f1f5f9;
font-size: 0.85rem;
}
.block-list { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1rem; }
.block-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem; background: #0f172a; border-radius: 0.5rem; }
.block-time { font-size: 0.8rem; color: #64748b; font-variant-numeric: tabular-nums; }
.block-label { flex: 1; font-size: 0.9rem; }
.block-duration { font-size: 0.78rem; color: #475569; }
.block-duration-custom { color: #818cf8; }
.add-block-form,
.edit-block-form {
display: flex;
align-items: center;
gap: 0.5rem;
flex-wrap: wrap;
background: #0f172a;
padding: 0.75rem;
border-radius: 0.75rem;
}
.add-block-form select,
.add-block-form input,
.edit-block-form select,
.edit-block-form input {
padding: 0.4rem 0.6rem;
background: #1e293b;
border: 1px solid #334155;
border-radius: 0.4rem;
color: #f1f5f9;
font-size: 0.85rem;
}
.add-block-form span,
.edit-block-form span { color: #64748b; }
.edit-block-form { border: 1px solid #4f46e5; }
.subject-block { display: flex; flex-direction: column; gap: 0; }
.options-panel {
background: #0f172a;
border-radius: 0 0 0.75rem 0.75rem;
padding: 0.75rem 1rem;
margin-top: -0.5rem;
border: 1px solid #1e293b;
border-top: none;
}
.option-list { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.75rem; }
.option-row {
display: flex;
align-items: center;
gap: 0.75rem;
padding: 0.4rem 0.6rem;
background: #1e293b;
border-radius: 0.4rem;
}
.option-text { flex: 1; font-size: 0.9rem; }
.option-edit-row {
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.4rem 0.6rem;
background: #1e293b;
border: 1px solid #4f46e5;
border-radius: 0.4rem;
}
.option-input {
flex: 1;
padding: 0.4rem 0.6rem;
background: #0f172a;
border: 1px solid #334155;
border-radius: 0.4rem;
color: #f1f5f9;
font-size: 0.9rem;
}
.option-add-row {
display: flex;
gap: 0.5rem;
}
.option-add-row .option-input { background: #1e293b; }
.routine-hint { font-size: 0.82rem; color: #64748b; margin-bottom: 1rem; }
.empty-small { color: #64748b; font-size: 0.9rem; padding: 1rem 0; }
.settings-card {
background: #1e293b;
border-radius: 1rem;
padding: 1.25rem 1.5rem;
}
.settings-row {
display: flex;
align-items: center;
gap: 1.5rem;
flex-wrap: wrap;
}
.settings-label { flex: 1; min-width: 180px; }
.settings-title { font-size: 0.95rem; font-weight: 500; margin-bottom: 0.2rem; }
.settings-hint { font-size: 0.8rem; color: #64748b; }
.settings-control { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }
.tz-select {
padding: 0.5rem 0.75rem;
background: #0f172a;
border: 1px solid #334155;
border-radius: 0.5rem;
color: #f1f5f9;
font-size: 0.875rem;
min-width: 220px;
}
.btn-primary {
padding: 0.5rem 1rem;
background: #4f46e5;
color: #fff;
border: none;
border-radius: 0.5rem;
cursor: pointer;
font-weight: 600;
transition: background 0.2s;
}
.btn-primary:hover { background: #4338ca; }
.btn-sm {
padding: 0.35rem 0.75rem;
border: 1px solid #334155;
background: transparent;
color: #94a3b8;
border-radius: 0.5rem;
cursor: pointer;
font-size: 0.8rem;
transition: all 0.2s;
}
.btn-sm:hover { background: #334155; }
.btn-sm.btn-danger { border-color: #7f1d1d; color: #fca5a5; }
.btn-sm.btn-danger:hover { background: #7f1d1d; }
.btn-primary.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
.break-badge {
font-size: 0.72rem;
background: #451a03;
color: #fdba74;
border: 1px solid #92400e;
padding: 0.15rem 0.5rem;
border-radius: 999px;
white-space: nowrap;
}
.break-check-label {
display: flex;
align-items: center;
gap: 0.35rem;
font-size: 0.85rem;
color: #94a3b8;
cursor: pointer;
white-space: nowrap;
}
.break-check-label input[type="checkbox"] { cursor: pointer; }
</style>