* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  background: linear-gradient(to bottom right, #eff6ff, #e0e7ff);
  min-height: 100vh;
  padding: 0;
}

/* サイトヘッダー */
.site-header {
  background-color: #111827;
  color: white;
  padding: 8px 16px;
  margin-bottom: 24px;
}

.header-link {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: bold;
  font-size: 18px;
  color: white;
  text-decoration: none;
  transition: opacity 0.2s;
}

.header-link:hover {
  opacity: 0.8;
}

.header-logo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 24px 24px;
}

.card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  padding: 24px;
  margin-bottom: 24px;
}

.header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.header h1 {
  font-size: 28px;
  color: #1f2937;
}

.icon-clock {
  width: 32px;
  height: 32px;
  color: #4f46e5;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

@media (min-width: 768px) {
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 8px;
}

.form-group input {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 16px;
}

.form-group input:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-group input:disabled {
  background: #f3f4f6;
  cursor: not-allowed;
}

.timer-display {
  background: #eef2ff;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 16px;
}

.timer-info {
  margin-bottom: 16px;
}

.timer-time {
  font-size: 48px;
  font-family: 'Courier New', monospace;
  text-align: center;
  color: #4f46e5;
  margin-bottom: 8px;
}

.timer-start-time {
  font-size: 13px;
  text-align: center;
  color: #6b7280;
  opacity: 0;
  transition: opacity 0.3s;
}

.timer-start-time.show {
  opacity: 1;
}

.button-group {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-start {
  background: #10b981;
  color: white;
}

.btn-start:hover:not(:disabled) {
  background: #059669;
}

.btn-save {
  background: #4f46e5;
  color: white;
}

.btn-save:hover:not(:disabled) {
  background: #4338ca;
}

.btn-delete-recent {
  background: #fef2f2;
  color: #dc2626;
  border: 2px solid #fca5a5;
}

.btn-delete-recent:hover:not(:disabled) {
  background: #fee2e2;
  border-color: #f87171;
}

.btn-delete {
  color: #ef4444;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-delete:hover {
  color: #dc2626;
}

.btn-resume {
  color: #10b981;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-resume:hover {
  color: #059669;
}

.btn-export {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #6366f1;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-export:hover {
  background: #4f46e5;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(99, 102, 241, 0.3);
}

.btn-export:active {
  transform: translateY(0);
}

.btn-date-nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-date-nav:hover {
  background: #e5e7eb;
  border-color: #d1d5db;
}

.date-picker {
  padding: 6px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
  color: #374151;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
}

.date-picker:hover {
  border-color: #d1d5db;
}

.date-picker:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

h2 {
  font-size: 20px;
  color: #1f2937;
  margin-bottom: 16px;
}

.category-stats-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 24px;
}

@media (min-width: 768px) {
  .category-stats-container {
    flex-direction: row;
    align-items: flex-start;
  }
}

.pie-chart-container {
  flex-shrink: 0;
  width: 100%;
  max-width: 200px;
  margin: 0 auto;
  position: relative;
}

@media (min-width: 768px) {
  .pie-chart-container {
    margin: 0;
  }
}

.pie-chart {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.1));
}

.pie-chart path {
  cursor: pointer;
  transition: opacity 0.2s;
}

.pie-chart path:hover {
  opacity: 1 !important;
  filter: brightness(1.1);
}

.pie-chart-tooltip {
  position: fixed;
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  white-space: nowrap;
  z-index: 1000;
}

.pie-chart-tooltip.show {
  opacity: 1;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  flex: 1;
}

@media (min-width: 768px) {
  .category-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.category-item {
  background: #f9fafb;
  border-radius: 8px;
  padding: 16px;
  position: relative;
}

.category-color-indicator {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 8px 0 0 8px;
}

.category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.category-task-pie {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.1));
}

.task-pie-segment {
  cursor: pointer;
  transition: opacity 0.2s;
}

.task-pie-segment:hover {
  opacity: 1 !important;
  filter: brightness(1.1);
}

.category-label {
  font-size: 14px;
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-visibility-checkbox {
  width: 16px;
  height: 16px;
  accent-color: #6366f1;
}

.category-time {
  font-size: 24px;
  font-weight: bold;
  color: #4f46e5;
  margin-bottom: 8px;
}

.category-tasks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.task-badge {
  display: inline-block;
  background: #e0e7ff;
  color: #4338ca;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
}

.task-badge:hover {
  background: #c7d2fe;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.total-item {
  background: #eef2ff;
  border-radius: 8px;
  padding: 16px;
  margin-top: 16px;
}

.total-label {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 4px;
}

.total-time {
  font-size: 32px;
  font-weight: bold;
  color: #4f46e5;
}

.empty-state {
  text-align: center;
  color: #6b7280;
  padding: 32px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead tr {
  border-bottom: 2px solid #e5e7eb;
}

th {
  text-align: left;
  padding: 12px 16px;
  color: #6b7280;
  font-weight: 500;
}

tbody tr {
  border-bottom: 1px solid #f3f4f6;
}

tbody tr:hover {
  background: #f9fafb;
}

td {
  padding: 12px 16px;
}

.category-badge {
  display: inline-block;
  padding: 4px 12px;
  background: #e0e7ff;
  color: #4338ca;
  border-radius: 9999px;
  font-size: 14px;
}

.timestamp {
  font-size: 14px;
  color: #6b7280;
}

.overflow-auto {
  overflow-x: auto;
}

#categoryStats {
  display: none;
}

#categoryStats.show {
  display: block;
}

#toastContainer {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  background: white;
  padding: 16px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast.hiding {
  animation: slideOut 0.3s ease-out forwards;
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

.toast-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
}

.toast-warning .toast-icon {
  color: #eab308;
}

.toast-error .toast-icon {
  color: #ef4444;
}

.toast-success .toast-icon {
  color: #10b981;
}

.toast-info .toast-icon {
  color: #3b82f6;
}

.toast-message {
  flex: 1;
  font-size: 14px;
  color: #1f2937;
}

.toast-close {
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-close:hover {
  color: #1f2937;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 12px;
  padding: 24px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.modal-header h3 {
  font-size: 18px;
  color: #1f2937;
  margin: 0;
}

.modal-content p {
  color: #374151;
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 24px;
}

.modal-buttons {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.btn-modal {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-cancel {
  background: #f3f4f6;
  color: #374151;
}

.btn-cancel:hover {
  background: #e5e7eb;
}

.btn-confirm {
  background: #4f46e5;
  color: white;
}

.btn-confirm:hover {
  background: #4338ca;
}

.edit-form {
  margin-bottom: 24px;
}

.edit-form .form-group {
  margin-bottom: 16px;
}

.edit-form .form-group:last-child {
  margin-bottom: 0;
}

.edit-form label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 6px;
}

.edit-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
  color: #1f2937;
  transition: all 0.2s;
  box-sizing: border-box;
}

.edit-input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.btn-edit {
  color: #6366f1;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-edit:hover {
  color: #4f46e5;
}

.gantt-container {
  margin-top: 16px;
  display: flex;
  gap: 8px;
}

.gantt-left-column {
  width: 280px;
  flex-shrink: 0;
}

.gantt-right-column {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.gantt-header {
  border-bottom: 2px solid #e5e7eb;
  padding-bottom: 8px;
  margin-bottom: 8px;
}

.gantt-header-timeline {
  display: flex;
  gap: 8px;
  width: 100%;
}

.gantt-time-label {
  flex: 1;
  text-align: center;
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
  min-width: 40px;
}

.gantt-row {
  margin-bottom: 12px;
  display: flex;
  height: 40px;
}

.gantt-row:hover {
  background: #f9fafb;
  border-radius: 4px;
}

.gantt-task-label {
  width: 280px;
  flex-shrink: 0;
  font-size: 14px;
  color: #1f2937;
  font-weight: 500;
  overflow: visible;
  padding-right: 12px;
  display: flex;
  align-items: center;
  height: 40px;
}

.gantt-task-category {
  font-size: 12px;
  color: #6b7280;
  display: block;
}

.btn-gantt-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border: none;
  background: #f3f4f6;
  color: #10b981;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-gantt-action:hover {
  background: #e5e7eb;
  color: #059669;
}

.btn-gantt-action.btn-gantt-stop {
  color: #ef4444;
}

.btn-gantt-action.btn-gantt-stop:hover {
  color: #dc2626;
}

.gantt-timeline {
  position: relative;
  height: 40px;
  background: #f9fafb;
  border-radius: 4px;
  width: 100%;
}

.gantt-timeline-inner {
  position: relative;
  height: 100%;
  width: 100%;
}

.gantt-bar {
  height: 30px;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  border-radius: 4px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  color: white;
  font-size: 12px;
  font-weight: 500;
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.3);
  position: absolute;
  top: 5px;
  transition: all 0.3s;
  min-width: 20px;
  cursor: pointer;
}

.gantt-bar:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(79, 70, 229, 0.4);
  filter: brightness(1.1);
  z-index: 10;
}

.gantt-bar-time {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gantt-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.gantt-controls button {
  padding: 6px 12px;
  border: 1px solid #d1d5db;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: #374151;
  transition: all 0.2s;
}

.gantt-controls button:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.gantt-controls button.active {
  background: #4f46e5;
  color: white;
  border-color: #4f46e5;
}

.gantt-total {
  margin-left: auto;
  font-size: 14px;
  color: #6b7280;
  font-weight: 500;
}

/* フロート表示（計測中） */
.floating-timer {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  padding: 16px 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s ease;
  min-width: 200px;
}

.floating-timer.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.floating-timer-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.floating-task-name {
  font-size: 16px;
  font-weight: bold;
  color: white;
}

.floating-task-category {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
}

.floating-start-time {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.floating-start-time::before {
  content: '🕐';
  font-size: 12px;
}

.floating-time {
  font-size: 28px;
  font-weight: bold;
  color: white;
  font-family: 'Courier New', monospace;
  text-align: center;
  margin-top: 4px;
  margin-bottom: 8px;
}

.floating-save-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
  margin-top: 8px;
}

.floating-save-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.6);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.floating-save-btn:active {
  transform: translateY(0);
}

.floating-save-btn i {
  width: 16px;
  height: 16px;
}

