:root {
  --bg: #eef1f8;
  --surface: #ffffff;
  --surface-alt: #f6f8fd;
  --border: #e4e8f2;
  --text: #1c2230;
  --text-muted: #6b7280;
  --text-faint: #9aa1b0;
  --primary: #4c5fe0;
  --primary-dark: #3c4bc4;
  --primary-soft: #eef0ff;
  --success: #2f9e58;
  --success-soft: #e9f8ef;
  --danger: #e6437b;
  --danger-soft: #fdedf3;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(24, 30, 51, 0.06);
  --shadow-md: 0 8px 24px -8px rgba(30, 40, 80, 0.16);
  --shadow-lift: 0 12px 28px -10px rgba(30, 40, 80, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  background: var(--bg);
  background-image: radial-gradient(circle at 15% 0%, #e3e8ff 0%, transparent 45%),
    radial-gradient(circle at 100% 10%, #ffe8f1 0%, transparent 40%);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px 64px;
}

/* Header */
.app-header {
  background: linear-gradient(120deg, #4c5fe0 0%, #6e5be0 55%, #b054d6 100%);
  padding: 36px 0 64px;
  margin-bottom: -40px;
}

.app-header-inner {
  padding: 0 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-md);
  backdrop-filter: blur(6px);
}

.app-header h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.01em;
}

.brand-sub {
  margin: 3px 0 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
}

/* Dashboard */
.dashboard {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.dashboard-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.dashboard-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
}

.dashboard-icon {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
}

.dashboard-icon svg {
  width: 22px;
  height: 22px;
}

.note-icon {
  background: var(--primary-soft);
  color: var(--primary);
}

.task-icon {
  background: var(--success-soft);
  color: var(--success);
}

.alert-icon {
  background: var(--danger-soft);
  color: var(--danger);
}

.success-icon {
  background: #e3fbf3;
  color: #12b886;
}

.reflection-icon {
  background: #f1ecfe;
  color: #7c4dff;
}

.reflection-highlight-card {
  grid-column: 1 / -1;
  align-items: flex-start;
}

.reflection-highlight-text {
  min-width: 0;
  flex: 1;
}

.reflection-highlight-week {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-top: 2px;
}

.reflection-highlight-comment {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.dashboard-number {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.dashboard-label {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 500;
}

/* Layout */
.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 720px) {
  .columns {
    grid-template-columns: 1fr;
  }
  .dashboard {
    grid-template-columns: 1fr;
  }
  .app-header {
    padding: 28px 0 56px;
  }
}

.panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
}

.reflection-panel {
  margin-top: 20px;
}

.reflection-week-field {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
}

.reflection-week-field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.reflection-week-field input[type="date"] {
  flex: 0 0 auto;
  width: auto;
}

.reflection-week-range {
  font-size: 12px;
  color: var(--text-faint);
  font-weight: 500;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.panel-icon {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
}

.panel-icon svg {
  width: 16px;
  height: 16px;
}

.panel h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

/* Forms */
.form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px dashed var(--border);
}

.form-row {
  flex-direction: row;
}

.form input,
.form textarea {
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface-alt);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.form textarea {
  resize: none;
  height: 74px;
  max-height: 320px;
  overflow-y: auto;
  line-height: 1.5;
  transition: height 0.18s ease, border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.form-row input {
  flex: 1;
}

.form input::placeholder,
.form textarea::placeholder {
  color: var(--text-faint);
}

.form input:focus,
.form textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.form button {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 10px -3px rgba(76, 95, 224, 0.55);
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
  white-space: nowrap;
}

.form button svg {
  width: 15px;
  height: 15px;
}

.form-row button {
  align-self: stretch;
}

.form button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px -3px rgba(76, 95, 224, 0.6);
}

.form button:active {
  transform: translateY(0);
  opacity: 0.92;
}

/* Lists */
.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 480px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.list::-webkit-scrollbar {
  width: 6px;
}

.list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 6px;
}

.item {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.item:hover {
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.item-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.item-body {
  font-size: 13px;
  color: var(--text-muted);
  white-space: pre-wrap;
  margin: 5px 0;
  line-height: 1.5;
}

.item-meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 6px;
  font-weight: 500;
}

.item-meta svg {
  width: 12px;
  height: 12px;
}

/* Note items */
.item-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.item-main {
  flex: 1;
  min-width: 0;
}

.item-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.item-edit {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.edit-title-input,
.edit-body-input {
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.edit-body-input {
  resize: vertical;
  min-height: 60px;
  line-height: 1.5;
}

.edit-title-input:focus,
.edit-body-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.item-edit-actions {
  display: flex;
  gap: 8px;
}

.save-btn,
.cancel-btn {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease, opacity 0.12s ease;
}

.save-btn {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
}

.save-btn:hover {
  opacity: 0.92;
}

.cancel-btn {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

.cancel-btn:hover {
  background: var(--surface-alt);
}

/* Task items */
.task-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.task-item.done {
  background: #f1f2f6;
  border-left-color: var(--text-faint);
}

.task-check-wrap {
  display: flex;
  align-items: center;
}

.task-check {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.task-main {
  flex: 1 1 140px;
  min-width: 140px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.task-item.done .task-title {
  text-decoration: line-through;
  color: var(--text-faint);
}

.task-status {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.task-status.is-pending {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.task-status.is-done {
  background: var(--success-soft);
  color: var(--success);
}

.task-item .item-meta {
  margin-top: 0;
  white-space: nowrap;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-faint);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.icon-btn svg {
  width: 15px;
  height: 15px;
}

.edit-btn:hover {
  background: var(--primary-soft);
  border-color: rgba(76, 95, 224, 0.25);
  color: var(--primary);
}

.delete-btn:hover {
  background: var(--danger-soft);
  border-color: rgba(230, 67, 123, 0.25);
  color: var(--danger);
}

.empty {
  color: var(--text-faint);
  font-size: 13px;
  text-align: center;
  padding: 28px 0;
}
