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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f4f6f8;
  color: #333;
  min-height: 100vh;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
}

/* ヘッダー */
header {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

header h1 {
  font-size: 1.4rem;
  margin-bottom: 12px;
  color: #2c3e50;
}

.partner-names {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.partner-names label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: #666;
}

.partner-names input {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.9rem;
  width: 110px;
  outline: none;
  transition: border-color 0.2s;
}

.partner-names input:focus {
  border-color: #4a90d9;
}

/* セクション共通 */
section {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

section h2 {
  font-size: 1rem;
  color: #2c3e50;
  margin-bottom: 10px;
}

.hint {
  font-size: 0.8rem;
  color: #999;
  margin-bottom: 10px;
}

/* 担当者選択 */
.assignee-select {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.assignee-btn {
  flex: 1;
  padding: 10px;
  border: 2px solid #ddd;
  border-radius: 8px;
  background: #f9f9f9;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.assignee-btn.active[data-assignee="1"] {
  background: #e8f4ff;
  border-color: #4a90d9;
  color: #4a90d9;
}

.assignee-btn.active[data-assignee="2"] {
  background: #ffeaea;
  border-color: #e05c5c;
  color: #e05c5c;
}

/* タスクグリッド */
.task-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.task-btn {
  padding: 14px 6px;
  border: none;
  border-radius: 10px;
  background: #f0f4f8;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  line-height: 1.3;
}

.task-btn:hover {
  transform: scale(1.04);
}

.task-btn:active {
  transform: scale(0.97);
}

.task-btn .task-icon {
  font-size: 1.4rem;
  display: block;
  margin-bottom: 4px;
}

/* 集計 */
.summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.period-tabs {
  display: flex;
  gap: 4px;
}

.tab-btn {
  padding: 4px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #f9f9f9;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn.active {
  background: #4a90d9;
  border-color: #4a90d9;
  color: #fff;
}

.balance-bar-wrap {
  margin-bottom: 14px;
}

.balance-bar {
  display: flex;
  border-radius: 8px;
  overflow: hidden;
  height: 36px;
  margin-bottom: 4px;
}

.bar-p1 {
  background: #4a90d9;
  color: #fff;
  font-size: 0.85rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width 0.4s ease;
  min-width: 0;
  overflow: hidden;
}

.bar-p2 {
  background: #e05c5c;
  color: #fff;
  font-size: 0.85rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width 0.4s ease;
  min-width: 0;
  overflow: hidden;
}

.balance-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: #666;
}

.count-summary {
  display: flex;
  gap: 10px;
}

.count-box {
  flex: 1;
  padding: 12px;
  border-radius: 8px;
  text-align: center;
}

.p1-box {
  background: #e8f4ff;
}

.p2-box {
  background: #ffeaea;
}

.count-name {
  font-size: 0.8rem;
  color: #666;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.count-num {
  font-size: 1.4rem;
  font-weight: bold;
  color: #333;
}

/* ログ */
.log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.clear-btn {
  padding: 5px 10px;
  border: 1px solid #e0a0a0;
  border-radius: 6px;
  background: #fff;
  color: #e05c5c;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.clear-btn:hover {
  background: #ffeaea;
}

.log-list {
  list-style: none;
  max-height: 300px;
  overflow-y: auto;
}

.log-list li {
  padding: 8px 10px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.log-list li:last-child {
  border-bottom: none;
}

.log-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: bold;
  white-space: nowrap;
}

.log-badge.p1 {
  background: #e8f4ff;
  color: #4a90d9;
}

.log-badge.p2 {
  background: #ffeaea;
  color: #e05c5c;
}

.log-time {
  margin-left: auto;
  color: #aaa;
  font-size: 0.78rem;
  white-space: nowrap;
}

.empty-msg {
  text-align: center;
  color: #bbb;
  padding: 20px;
  font-size: 0.9rem;
}

@media (max-width: 375px) {
  .task-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .partner-names {
    flex-direction: column;
  }
}
