:root {
  --bg: #eef1f8;
  --bg-grad-1: #f7f9fe;
  --bg-grad-2: #e9edf9;
  --panel: #ffffff;
  --border: #e6e9f2;
  --text: #1f2733;
  --muted: #838ea0;
  --accent: #4360e6;
  --accent-2: #6b8bff;
  --accent-dark: #2f47bd;
  --accent-soft: #eef2ff;
  --danger: #e2574c;
  --done: #a3adbd;
  --shadow: 0 6px 24px rgba(40, 55, 95, 0.08);
  --shadow-sm: 0 2px 8px rgba(40, 55, 95, 0.06);
  --radius: 16px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  font-family: "Noto Sans JP", "Segoe UI", "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
  color: var(--text);
  line-height: 1.65;
  background: linear-gradient(160deg, var(--bg-grad-1), var(--bg-grad-2));
  min-height: 100vh;
}

/* ---- ヘッダー ---- */
.app-header {
  background: linear-gradient(120deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff;
  padding: 26px 24px;
  box-shadow: 0 4px 20px rgba(67, 96, 230, 0.25);
}

.app-header__inner {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.app-logo {
  font-size: 2rem;
  background: rgba(255, 255, 255, 0.18);
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.app-header h1 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.app-subtitle {
  margin: 2px 0 0;
  font-size: 0.86rem;
  opacity: 0.9;
}

/* ---- コンテナ ---- */
.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 28px 24px 48px;
}

/* ---- ダッシュボード ---- */
.dashboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

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

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-icon--memo {
  background: #eaf1ff;
}
.stat-icon--task {
  background: #e9f8ee;
}
.stat-icon--open {
  background: #fff1e6;
}
.stat-icon--today {
  background: #ede9fe;
}

.stat-body {
  flex: 1;
  min-width: 0;
}

.stat-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text);
}

.stat-unit {
  color: var(--muted);
  font-size: 0.8rem;
  align-self: flex-end;
  padding-bottom: 6px;
}

.stat-card--accent {
  background: linear-gradient(135deg, #4360e6, #6b8bff);
  border-color: transparent;
}
.stat-card--accent .stat-label,
.stat-card--accent .stat-value,
.stat-card--accent .stat-unit {
  color: #fff;
}
.stat-card--accent .stat-label,
.stat-card--accent .stat-unit {
  opacity: 0.9;
}
.stat-card--accent .stat-icon--open {
  background: rgba(255, 255, 255, 0.22);
}

/* ---- レイアウト ---- */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  align-items: start;
}

.column {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* ---- パネル ---- */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel__head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel__icon {
  font-size: 1.1rem;
}

.count-chip {
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 700;
  min-width: 26px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ---- フォーム ---- */
.form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

input[type="text"],
textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: #fbfcfe;
  resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

input[type="text"]::placeholder,
textarea::placeholder {
  color: #aab3c2;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(67, 96, 230, 0.14);
}

.btn {
  padding: 12px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.15s, background 0.15s;
}

.btn--primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 4px 14px rgba(67, 96, 230, 0.28);
}

.btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(67, 96, 230, 0.34);
}

.btn--primary:active {
  transform: translateY(0);
}

.msg {
  margin: 0;
  font-size: 0.82rem;
  color: var(--danger);
  min-height: 1em;
}

/* ---- 一覧 ---- */
.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.list:empty::after {
  content: "まだありません";
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 20px 0;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
}

/* メモカード */
.memo-item {
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent-2);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: #fbfcff;
  transition: box-shadow 0.15s, transform 0.15s;
}

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

.memo-item .memo-title {
  font-weight: 700;
  margin-bottom: 4px;
  font-size: 0.98rem;
}

.memo-item .memo-body {
  white-space: pre-wrap;
  word-break: break-word;
  color: #3c4657;
  font-size: 0.92rem;
}

.item-meta {
  color: var(--muted);
  font-size: 0.76rem;
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

/* タスク */
.task-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: #fbfcff;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: box-shadow 0.15s;
}

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

.task-item.done {
  background: #f5f7fa;
  border-color: #e9edf3;
}

.task-main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.task-main input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border: 2px solid #c4ccda;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: background 0.15s, border-color 0.15s;
}

.task-main input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.task-main input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

.task-text {
  word-break: break-word;
  flex: 1;
  font-size: 0.95rem;
  padding-top: 1px;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  margin-left: 6px;
}

.badge.open {
  background: #fff2e6;
  color: #c26a1f;
}

.badge.closed {
  background: #e6f6ec;
  color: #2e8b57;
}

.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.76rem;
  padding: 2px 4px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.link-btn:hover {
  color: var(--danger);
  background: #fdecea;
}

/* ---- レスポンシブ ---- */
@media (max-width: 980px) {
  .dashboard {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 780px) {
  .dashboard {
    grid-template-columns: 1fr;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .app-header h1 {
    font-size: 1.2rem;
  }
}
