* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: #fff;
    color: #333;
    font-family: sans-serif;
}

/* ---------------------------------------------------------------------------
   App shell — full viewport, mobile-first
--------------------------------------------------------------------------- */

.app {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    max-width: 600px;
    margin: 0 auto;
    overflow: hidden;
}

/* Top panel: fixed height */
.top-panel {
    flex: 0 0 auto;
    padding: 16px;
    border-bottom: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Task list: takes remaining space, scrollable */
.task-list-panel {
    flex: 1 1 0;
    overflow-y: auto;
    padding: 0 8px;
}

/* ---------------------------------------------------------------------------
   Task form (top panel)
--------------------------------------------------------------------------- */

.task-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.task-form-input {
    width: 100%;
    font-size: 20px;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: sans-serif;
    color: #333;
    outline: none;
}

.task-form-input:focus {
    border-color: #999;
}

.task-form-row {
    display: flex;
    gap: 12px;
}

.task-form-add-btn {
    flex: 1;
    padding: 10px;
    font-size: 16px;
    font-family: sans-serif;
    background: #333;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    width: auto;
}

.task-form-add-btn:active {
    background: #555;
}

.task-form-priority-select {
    flex: 1;
    padding: 10px;
    font-size: 16px;
    font-family: sans-serif;
    border: 1px solid #ddd;
    border-radius: 8px;
    outline: none;
    background: #fff;
    color: #333;
}

/* ---------------------------------------------------------------------------
   Task rows
--------------------------------------------------------------------------- */

.task-row {
    display: flex;
    align-items: center;
    padding: 12px 8px;
    border-bottom: 1px solid #f0f0f0;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.task-row:active {
    background: #f9f9f9;
}

.task-row input[type="checkbox"] {
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    cursor: pointer;
}

.task-title {
    flex: 1 1 0;
    font-size: 16px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.task-title.completed {
    text-decoration: line-through;
    color: #aaa;
}

.goal-swatch {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

/* ---------------------------------------------------------------------------
   Bottom sheet
--------------------------------------------------------------------------- */

.sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 10;
}

.task-detail-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 600px;
    margin: 0 auto;
    background: #fff;
    border-radius: 16px 16px 0 0;
    padding: 16px 20px 32px;
    z-index: 11;
    animation: slide-up 0.25s ease-out;
}

@keyframes slide-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

.sheet-handle {
    width: 40px;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    margin: 0 auto 16px;
    cursor: pointer;
}

.sheet-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.sheet-section label {
    font-size: 14px;
    font-weight: 600;
    color: #555;
}

.sheet-section select {
    padding: 10px;
    font-size: 16px;
    font-family: sans-serif;
    border: 1px solid #ddd;
    border-radius: 8px;
    outline: none;
    background: #fff;
    color: #333;
}

.sheet-divider {
    font-size: 13px;
    font-weight: 600;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 8px 0 12px;
    border-top: 1px solid #eee;
    padding-top: 12px;
}

.sheet-text-input {
    width: 100%;
    padding: 10px 12px;
    font-size: 16px;
    font-family: sans-serif;
    border: 1px solid #ddd;
    border-radius: 8px;
    outline: none;
    color: #333;
}

.sheet-text-input:focus {
    border-color: #999;
}

.color-palette {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 4px 0;
}

.color-swatch-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
}

.color-swatch-btn.selected {
    border-color: #333;
}

.sheet-create-btn {
    padding: 10px 16px;
    font-size: 15px;
    font-family: sans-serif;
    background: #333;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    align-self: flex-start;
    width: auto;
}

.sheet-create-btn:active {
    background: #555;
}

.delete-task-btn {
    width: 100%;
    margin-top: 8px;
    padding: 12px;
    font-size: 16px;
    font-family: sans-serif;
    background: none;
    border: 1px solid #e74c3c;
    color: #e74c3c;
    border-radius: 8px;
    cursor: pointer;
}

.delete-task-btn:active {
    background: #fdf0ef;
}
