/* public/css/app.css */
body { font-family: system-ui, sans-serif; margin: 0; }
body > form { margin: 2rem; }
form { max-width: 320px; display: flex; flex-direction: column; gap: 0.75rem; }
.error { color: #b00020; min-height: 1.2em; }
.success { color: #16a34a; min-height: 1.2em; }

.field-invalid {
    border-color: #dc2626;
    background-color: #fef2f2;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.topbar {
    display: none;
}

.sidebar {
    width: 220px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1.5rem 1rem;
    background: #1f2937;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #d1d5db;
    text-decoration: none;
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
}

.sidebar .nav-link:hover {
    background: #374151;
    color: #fff;
}

.sidebar .nav-link.active {
    background: #2563eb;
    color: #fff;
}

.nav-link-settings {
    margin-top: auto;
}

.nav-link-admin {
    margin-top: auto;
}

.nav-icon {
    width: 1.1rem;
    height: 1.1rem;
    flex-shrink: 0;
}

#household-switcher {
    margin-bottom: 1rem;
}

#household-switcher select {
    width: 100%;
    padding: 0.4rem;
    border-radius: 6px;
    border: 1px solid #4b5563;
    background: #111827;
    color: #fff;
}

#include-personal-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

.main-area {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 2rem;
    background: #f3f4f6;
}

.page-container {
    width: 100%;
    max-width: 960px;
}

#event-form button[type="submit"] {
    background: #86efac;
    border: 1px solid #4ade80;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    cursor: pointer;
}

#event-form button[type="submit"]:hover {
    background: #6ee7a0;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: #6b7280;
    padding: 0.1rem 0.4rem;
}

.modal-close:hover {
    color: #111827;
}

.event-duration-end {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 6px;
    transition: background-color 0.15s ease;
}

.event-duration-end.all-day {
    background: #e5e7eb;
}

.event-duration-end.needs-input {
    background: #dbeafe;
}

.event-end-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.event-end-row input[type="datetime-local"] {
    flex: 1;
}

#journal-composer {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

#journal-composer textarea {
    flex: 1;
    min-height: 2.5rem;
    padding: 0.5rem;
}

#journal-range-filter {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

#journal-range-day-count {
    color: #6b7280;
}

#journal-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.journal-entry {
    padding: 0.5rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.journal-entry.disregarded {
    opacity: 0.5;
    text-decoration: line-through;
    font-style: italic;
}

.journal-entry-time {
    font-size: 0.8rem;
    color: #6b7280;
    flex-shrink: 0;
}

.initials-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    height: 1.75rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: #dbeafe;
    color: #1e3a8a;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.journal-entry-message {
    flex: 1;
    min-width: 200px;
}

.journal-entry-actions {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    flex-shrink: 0;
}

#todo-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.todo-group {
    margin-top: 0.75rem;
}

.todo-group-heading {
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    user-select: none;
}

.todo-group-heading-overdue {
    color: #f87171;
}

.todo-group-heading-upcoming {
    color: #60a5fa;
}

.todo-group-items {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.todo-item {
    padding: 0.5rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.todo-title {
    flex: 1;
    min-width: 150px;
}

.todo-due {
    font-size: 0.8rem;
    color: #6b7280;
}

.todo-priority {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    text-transform: uppercase;
}

.todo-priority-low { background: #dcfce7; color: #166534; }
.todo-priority-medium { background: #fef9c3; color: #854d0e; }
.todo-priority-high { background: #fee2e2; color: #991b1b; }

.todo-actions {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
}

.todo-row-assignee-picker {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.4rem;
    margin-top: 0.3rem;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    font-size: 0.85rem;
    flex-basis: 100%;
}

.journal-history-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 0.9rem;
    width: 1.0rem;
    padding: 0;
    border: none;
    border-radius: 4px;
    line-height: 0;
}

.journal-history-btn svg {
    width: 0.65rem;
    height: 0.65rem;
}

.todo-calendar-item {
    background-color: #fef9c3 !important;
    border-color: #eab308 !important;
    color: #854d0e !important;
}

@media (max-width: 768px) {
    .app-shell {
        display: block;
    }

    .topbar {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
        background: #1f2937;
        color: #fff;
    }

    .topbar button {
        background: none;
        border: none;
        color: #fff;
        font-size: 1.5rem;
        cursor: pointer;
        line-height: 1;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        z-index: 100;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-area {
        padding: 1rem;
    }
}
