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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f7fa;
  color: #1e293b;
  min-height: 100vh;
}

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

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #2563eb;
  margin-bottom: 20px;
  border-bottom: 2px solid #2563eb;
  padding-bottom: 8px;
}

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

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

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

@media (max-width: 500px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #374151;
}

.required {
  color: #ef4444;
  margin-left: 2px;
}

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

input:focus {
  border-color: #2563eb;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 24px;
  font-size: 0.95rem;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
  width: 100%;
}

.btn-primary:hover {
  background: #1d4ed8;
}

/* フィルター */
.filter-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.filter-tabs {
  display: flex;
  gap: 6px;
}

.tab {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid #d1d5db;
  background: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  color: #374151;
}

.tab.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
  font-weight: 600;
}

.summary {
  font-size: 0.82rem;
  color: #6b7280;
}

/* 一覧 */
.list-section {
  background: #fff;
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

#orderList {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.order-item {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  transition: opacity 0.2s;
}

.order-item.overdue {
  border-color: #fca5a5;
  background: #fff7f7;
}

.order-item.received {
  opacity: 0.5;
  background: #f9fafb;
}

.order-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.order-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.order-main input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.order-name {
  font-weight: 600;
  font-size: 0.98rem;
  word-break: break-all;
}

.order-supplier {
  font-size: 0.82rem;
  color: #6b7280;
}

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

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

.order-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.8rem;
  color: #6b7280;
  margin-left: 28px;
}

.due-date {
  font-weight: 500;
}

.due-date.overdue {
  color: #dc2626;
  font-weight: 700;
}

.due-date.soon {
  color: #d97706;
  font-weight: 600;
}

.overdue-badge {
  background: #fee2e2;
  color: #dc2626;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.order-note {
  font-size: 0.8rem;
  color: #9ca3af;
  margin-left: 28px;
  margin-top: 4px;
  font-style: italic;
}

.empty-msg {
  text-align: center;
  color: #9ca3af;
  font-size: 0.9rem;
  padding: 24px;
  display: none;
}
