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

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

.container {
  max-width: 960px;
  margin: 0 auto;
}

h1 {
  font-size: 1.4rem;
  color: #2c3e50;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 3px solid #4a90d9;
}

h2 {
  font-size: 1rem;
  color: #555;
  margin-bottom: 12px;
}

/* フォーム */
.form-section {
  background: #fff;
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  margin-bottom: 20px;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group:nth-child(1) { flex: 2 1 160px; }
.form-group:nth-child(2) { flex: 1 1 140px; }
.form-group:nth-child(3) { flex: 1 1 110px; }
.form-group--btn { flex: 0 0 auto; }

label {
  font-size: 0.8rem;
  color: #777;
  font-weight: 600;
}

input[type="text"],
input[type="date"],
input[type="number"] {
  padding: 8px 10px;
  border: 1.5px solid #d0d7de;
  border-radius: 6px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}

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

.btn {
  padding: 8px 18px;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
  font-weight: 600;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.btn:hover { opacity: 0.85; }

.btn--primary {
  background: #4a90d9;
  color: #fff;
}

.btn--danger {
  background: #e74c3c;
  color: #fff;
  font-size: 0.85rem;
  padding: 6px 14px;
}

.error-msg {
  color: #e74c3c;
  font-size: 0.82rem;
  margin-top: 8px;
  min-height: 1em;
}

/* ガント */
.gantt-section {
  background: #fff;
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.gantt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

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

.gantt-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.gantt-table {
  display: flex;
  min-width: 600px;
}

/* ラベル列 */
.gantt-labels {
  flex: 0 0 140px;
  border-right: 2px solid #e0e0e0;
}

.label-header {
  height: 36px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-size: 0.8rem;
  color: #888;
  font-weight: 600;
  border-bottom: 1px solid #eee;
  background: #fafafa;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  padding: 0 8px 0 10px;
  border-bottom: 1px solid #f0f0f0;
  gap: 4px;
}

.label-name {
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #ccc;
  font-size: 1rem;
  padding: 2px 4px;
  line-height: 1;
  transition: color 0.2s;
  flex-shrink: 0;
}

.delete-btn:hover { color: #e74c3c; }

/* チャートエリア */
.gantt-chart-area {
  flex: 1;
  overflow: hidden;
}

/* 軸ヘッダー */
.gantt-axis {
  height: 36px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #eee;
  background: #fafafa;
  position: relative;
}

.axis-label {
  position: absolute;
  font-size: 0.72rem;
  color: #999;
  transform: translateX(-50%);
  white-space: nowrap;
}

/* バー行 */
.gantt-bars {
  position: relative;
}

.bar-row {
  height: 40px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #f0f0f0;
  position: relative;
}

.bar {
  position: absolute;
  height: 22px;
  background: #4a90d9;
  border-radius: 4px;
  display: flex;
  align-items: center;
  padding: 0 6px;
  color: #fff;
  font-size: 0.72rem;
  overflow: hidden;
  white-space: nowrap;
  min-width: 4px;
}

/* 週区切り線 */
.grid-line {
  position: absolute;
  top: 0;
  width: 1px;
  background: #f0f0f0;
  pointer-events: none;
}

@media (max-width: 600px) {
  .gantt-labels { flex: 0 0 110px; }
  h1 { font-size: 1.2rem; }
}
