/* ============= PLAN SCREEN ============= */
.plan-tabs {
    display: flex; gap: 4px; margin-bottom: 16px;
    background: var(--card-bg); border-radius: var(--radius-sm); padding: 4px;
}
.plan-tab {
    flex: 1; padding: 10px; border: none; background: transparent;
    color: var(--text-secondary); font-size: 13px; font-weight: 600;
    border-radius: var(--radius-xs); cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 6px;
}
.plan-tab.active { background: var(--primary); color: white; }
.tab-content { display: none; }
.tab-content.active { display: block; }
.plan-date-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.plan-date-header span { font-weight: 600; font-size: 14px; }
.view-history { color: var(--text-secondary); font-size: 13px; text-decoration: none; }

/* Tasks */
.add-task-row { display: flex; gap: 8px; margin-bottom: 16px; }
.add-task-row input {
    flex: 1; padding: 12px 16px; border: 1px solid var(--border);
    border-radius: var(--radius-xs); background: var(--card-bg); color: var(--text); font-size: 14px; outline: none;
}
.add-task-row input:focus { border-color: var(--primary); }
.add-btn { width: 44px; height: 44px; border-radius: var(--radius-xs); background: var(--primary); color: white; border: none; font-size: 18px; cursor: pointer; }
.task-item { display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--card-bg); border-radius: var(--radius-xs); margin-bottom: 8px; box-shadow: var(--shadow); }

/* Goals */
.add-goal-form { margin-bottom: 16px; }
.add-goal-form input {
    width: 100%; padding: 12px 16px; border: 1px solid var(--border);
    border-radius: var(--radius-xs); background: var(--card-bg); color: var(--text);
    font-size: 14px; margin-bottom: 8px; outline: none;
}
.add-goal-form input:focus { border-color: var(--primary); }
.add-goal-btn {
    width: 100%; padding: 12px; background: var(--primary); color: white;
    border: none; border-radius: var(--radius-xs); font-size: 14px; font-weight: 600; cursor: pointer;
}
.goal-item { padding: 16px; background: var(--primary-light); border-radius: var(--radius-sm); margin-bottom: 12px; }
.goal-item-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.goal-item-header .goal-target { color: var(--primary); }
.goal-item-header h4 { flex: 1; font-size: 15px; }
.goal-actions { display: flex; gap: 8px; }
.goal-actions button { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; }
.goal-desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.goal-progress-bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.goal-progress-fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width 0.3s; }
.goal-progress-text { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.milestones { margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(37, 99, 235, 0.2); }
.milestones h5 { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.milestone-input-row { display: flex; gap: 8px; margin-bottom: 8px; }
.milestone-input-row input { flex: 1; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-xs); background: var(--card-bg); color: var(--text); font-size: 13px; outline: none; }
.milestone-input-row button { padding: 8px 12px; background: var(--primary); color: white; border: none; border-radius: var(--radius-xs); cursor: pointer; }
.milestone-item { display: flex; align-items: center; gap: 8px; padding: 8px; font-size: 13px; }
.milestone-item input[type="checkbox"] { accent-color: var(--primary); }

/* Reminders */
.add-reminder-form { margin-bottom: 16px; }
.add-reminder-form input {
    width: 100%; padding: 12px 16px; border: 1px solid var(--border);
    border-radius: var(--radius-xs); background: var(--card-bg); color: var(--text);
    font-size: 14px; margin-bottom: 8px; outline: none;
}
.reminder-date-row { display: flex; gap: 8px; margin-bottom: 8px; }
.reminder-date-row input { flex: 1; }
.set-reminder-btn {
    width: 100%; padding: 12px; background: var(--primary); color: white;
    border: none; border-radius: var(--radius-xs); font-size: 14px; font-weight: 600; cursor: pointer;
}
.reminder-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.reminder-item input[type="checkbox"] { accent-color: var(--primary); }
.reminder-item .reminder-info { flex: 1; }
.reminder-item .reminder-title { font-size: 14px; font-weight: 600; }
.reminder-item .reminder-date { font-size: 12px; color: var(--text-muted); }

/* Calculator */
.calculator-display {
    background: var(--card-bg); border-radius: var(--radius-sm); padding: 20px;
    text-align: right; font-size: 36px; font-weight: 300; margin-bottom: 16px;
    min-height: 80px; display: flex; align-items: center; justify-content: flex-end; box-shadow: var(--shadow);
}
.calc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.calc-btn {
    padding: 20px; border: none; border-radius: var(--radius-sm);
    font-size: 20px; font-weight: 500; cursor: pointer;
    background: var(--card-bg); color: var(--text); box-shadow: var(--shadow);
}
.calc-btn:active { transform: scale(0.95); }
.calc-btn.func { background: var(--red-light); color: var(--red); }
.calc-btn.op { background: var(--primary); color: white; }

/* ── Diary ── */
.diary-input {
    padding: 10px 12px; border: 1.5px solid var(--border);
    border-radius: var(--radius-xs); background: var(--bg);
    color: var(--text); font-size: 13px; outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}
.diary-input:focus { border-color: var(--primary); background: var(--card-bg); }

/* Compose card */
.diary-compose-card {
    background: var(--card-bg); border-radius: var(--radius-sm);
    box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px;
    border-top: 3px solid var(--primary);
}
.diary-compose-header {
    display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
}
.diary-compose-icon {
    width: 38px; height: 38px; border-radius: 10px;
    background: var(--primary-light); color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; flex-shrink: 0;
}
.diary-compose-title { font-size: 14px; font-weight: 700; }
.diary-compose-sub   { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.diary-compose-row {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px;
}
.diary-compose-row .diary-input { width: 100%; }
.diary-title-row { margin-bottom: 8px; }
.diary-title-row .diary-input { width: 100%; }

.diary-textarea {
    width: 100%; padding: 12px 14px;
    border: 1.5px solid var(--border); border-radius: var(--radius-xs);
    background: var(--bg); color: var(--text);
    font-size: 14px; line-height: 1.7; outline: none;
    resize: vertical; min-height: 110px;
    font-family: inherit; margin-bottom: 10px;
    transition: border-color 0.2s;
}
.diary-textarea:focus { border-color: var(--primary); background: var(--card-bg); }
.diary-textarea::placeholder { color: var(--text-muted); }

.diary-compose-footer {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.diary-counter { font-size: 11px; color: var(--text-muted); }
.diary-save-btn {
    padding: 10px 20px; background: var(--primary); color: white;
    border: none; border-radius: var(--radius-xs);
    font-size: 13px; font-weight: 700; cursor: pointer;
    display: flex; align-items: center; gap: 6px;
    transition: background 0.2s;
}
.diary-save-btn:hover  { background: var(--primary-dark); }
.diary-save-btn:active { transform: scale(0.97); }

/* Filter bar */
.diary-filter-bar {
    display: flex; gap: 8px; margin-bottom: 12px;
}
.diary-search-wrap {
    flex: 1; position: relative;
}
.diary-search-icon {
    position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
    font-size: 12px; color: var(--text-muted); pointer-events: none;
}
.diary-search-input {
    width: 100%; padding: 10px 12px 10px 32px;
    border: 1.5px solid var(--border); border-radius: var(--radius-xs);
    background: var(--bg); color: var(--text); font-size: 13px; outline: none;
    transition: border-color 0.2s; font-family: inherit;
}
.diary-search-input:focus { border-color: var(--primary); background: var(--card-bg); }
.diary-filter-select { width: 90px; flex-shrink: 0; }

/* Stats row */
.diary-stats-row {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 8px; margin-bottom: 12px;
}
.diary-stat {
    background: var(--card-bg); border-radius: var(--radius-xs);
    padding: 10px 12px; text-align: center; box-shadow: var(--shadow);
    display: flex; flex-direction: column; gap: 2px;
}
.diary-stat-val   { font-size: 18px; font-weight: 800; color: var(--primary); }
.diary-stat-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; }

/* Entry cards */
.diary-entry-card {
    background: var(--card-bg); border-radius: var(--radius-sm);
    box-shadow: var(--shadow); margin-bottom: 10px; overflow: hidden;
}
.diary-entry-top {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px; cursor: pointer;
    border-left: 3px solid var(--primary);
}
.diary-entry-mood-badge {
    font-size: 22px; flex-shrink: 0; line-height: 1;
}
.diary-entry-info { flex: 1; min-width: 0; }
.diary-entry-title-text {
    font-size: 14px; font-weight: 700; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.diary-entry-meta-row {
    display: flex; align-items: center; gap: 8px; margin-top: 2px;
}
.diary-entry-date  { font-size: 11px; color: var(--text-muted); }
.diary-entry-words { font-size: 11px; color: var(--text-muted); }
.diary-entry-chevron {
    color: var(--text-muted); font-size: 11px; flex-shrink: 0;
    transition: transform 0.25s;
}
.diary-entry-card.expanded .diary-entry-chevron { transform: rotate(180deg); }

.diary-entry-body {
    display: none; padding: 0 14px 14px;
    border-top: 1px solid var(--border);
}
.diary-entry-card.expanded .diary-entry-body { display: block; }
.diary-entry-body-text {
    font-size: 14px; color: var(--text); line-height: 1.7;
    white-space: pre-wrap; padding-top: 12px;
}
.diary-entry-actions {
    display: flex; gap: 8px; margin-top: 12px; padding-top: 10px;
    border-top: 1px solid var(--border);
}
.diary-action-btn {
    flex: 1; padding: 8px; border: 1px solid var(--border);
    border-radius: var(--radius-xs); background: var(--bg);
    font-size: 12px; font-weight: 600; color: var(--text-muted);
    cursor: pointer; display: flex; align-items: center;
    justify-content: center; gap: 5px; transition: all 0.2s;
}
.diary-action-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.diary-action-btn.delete:hover { border-color: var(--red); color: var(--red); background: var(--red-light); }

/* Edit mode */
.diary-edit-area {
    width: 100%; padding: 10px 12px; margin-top: 10px;
    border: 1.5px solid var(--primary); border-radius: var(--radius-xs);
    background: var(--bg); color: var(--text); font-size: 14px;
    line-height: 1.7; outline: none; resize: vertical;
    min-height: 100px; font-family: inherit;
}
.diary-edit-actions { display: flex; gap: 8px; margin-top: 8px; }
.diary-edit-save {
    flex: 1; padding: 9px; background: var(--primary); color: white;
    border: none; border-radius: var(--radius-xs);
    font-size: 13px; font-weight: 700; cursor: pointer;
}
.diary-edit-cancel {
    padding: 9px 16px; background: var(--bg); color: var(--text-muted);
    border: 1px solid var(--border); border-radius: var(--radius-xs);
    font-size: 13px; font-weight: 600; cursor: pointer;
}

/* No entries */
.diary-no-results {
    text-align: center; padding: 32px 16px; color: var(--text-muted);
}
.diary-no-results i { font-size: 32px; margin-bottom: 10px; display: block; color: var(--border); }

@media (max-width: 360px) {
    .diary-compose-row { grid-template-columns: 1fr; }
    .diary-filter-select { width: 70px; }
}
