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

:root {
  --bg: #F2F2F7;
  --card: #FFFFFF;
  --label: #1C1C1E;
  --secondary: #8E8E93;
  --accent: #007AFF;
  --section-header-bg: #D2E6F7;
  --section-header-text: #2E6DB4;
  --orange: #FF9500;
  --done: #C7C7CC;
  --separator: #E5E5EA;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', sans-serif;
  background: var(--bg);
  color: var(--label);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── ヘッダー ── */
.header {
  position: sticky;
  top: 0;
  background: var(--card);
  border-bottom: 1px solid var(--separator);
  padding: 12px 16px 10px;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

.header-left h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--label);
  line-height: 1.1;
}

.header-left .date-sub {
  font-size: 15px;
  color: var(--secondary);
  margin-top: 2px;
}

.reload-btn {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: var(--accent);
  font-size: 20px;
  border-radius: 8px;
  transition: background 0.15s;
  line-height: 1;
}

.reload-btn:active {
  background: #E5E5EA;
}

.reload-btn.spinning {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── メインコンテンツ ── */
main {
  padding: 12px 16px 40px;
  max-width: 640px;
  margin: 0 auto;
}

/* ── 承認待ちバナー ── */
.approval-banner {
  background: var(--card);
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.approval-bar {
  background: var(--orange);
  height: 4px;
}

.approval-content {
  padding: 12px 14px;
}

.approval-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--orange);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.approval-items {
  list-style: none;
}

.approval-items li {
  font-size: 15px;
  color: var(--label);
  padding: 3px 0;
}

/* ── セクション ── */
.section {
  margin-bottom: 20px;
}

.section-card {
  background: var(--card);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.section-header {
  font-size: 13px;
  font-weight: 600;
  color: var(--section-header-text);
  letter-spacing: 0.3px;
  padding: 10px 14px;
  background: var(--section-header-bg);
  border-bottom: 1px solid rgba(46, 109, 180, 0.18);
}

/* ── タスク行 ── */
.task-row {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--separator);
  gap: 12px;
  cursor: pointer;
  transition: background 0.1s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.task-row:last-child {
  border-bottom: none;
}

.task-row:active {
  background: var(--bg);
}

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

/* ── チェックサークル ── */
.check-circle {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--done);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  background: transparent;
}

.task-row.done .check-circle {
  background: var(--accent);
  border-color: var(--accent);
}

.check-icon {
  display: none;
  color: white;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.task-row.done .check-icon {
  display: block;
}

/* ── タスクテキスト ── */
.task-text {
  flex: 1;
  font-size: 17px;
  color: var(--label);
  line-height: 1.35;
}

/* ── 優先度バッジ ── */
.badge {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  line-height: 1.4;
}

.badge-high {
  background: rgba(255, 59, 48, 0.12);
  color: #FF3B30;
}

.badge-mid {
  background: rgba(255, 149, 0, 0.12);
  color: #FF9500;
}

.badge-low {
  background: rgba(0, 122, 255, 0.10);
  color: #007AFF;
}

.badge-monthly {
  background: rgba(88, 86, 214, 0.10);
  color: #5856D6;
}

.badge-weekly {
  background: rgba(52, 199, 89, 0.12);
  color: #34C759;
}

.badge-yearly {
  background: rgba(255, 149, 0, 0.10);
  color: #FF9500;
}

/* ── テキスト行（予定など） ── */
.text-row {
  padding: 10px 14px;
  font-size: 15px;
  color: var(--secondary);
  border-bottom: 1px solid var(--separator);
  min-height: 40px;
  display: flex;
  align-items: center;
}

.text-row:last-child {
  border-bottom: none;
}

/* ── メモ行（■秘書からなど） ── */
.memo-section {
  background: var(--card);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  margin-bottom: 20px;
}

.memo-section p {
  font-size: 14px;
  color: var(--secondary);
  line-height: 1.6;
  white-space: pre-wrap;
}

.memo-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--section-header-text);
  letter-spacing: 0.3px;
  margin: -12px -14px 8px;
  padding: 10px 14px;
  background: var(--section-header-bg);
  border-radius: 12px 12px 0 0;
  border-bottom: 1px solid rgba(46, 109, 180, 0.18);
}

/* ── ローディング ── */
#loading {
  text-align: center;
  padding: 60px 0;
  color: var(--secondary);
  font-size: 15px;
}

/* ── エラー ── */
#error-msg {
  display: none;
  background: rgba(255, 59, 48, 0.08);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  color: #FF3B30;
  margin-bottom: 16px;
}

/* ── デスクトップ余白 ── */
@media (min-width: 640px) {
  main {
    padding: 20px 24px 60px;
  }
}
