/* ===== リセット & ベース ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --error: #dc2626;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --radius: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
}

/* ===== レイアウト ===== */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ===== ヘッダー ===== */
.site-header {
  background: var(--primary);
  padding: 1rem 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-title {
  color: #fff;
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.nav-link {
  color: rgba(255,255,255,0.88);
  text-decoration: none;
  padding: 0.3rem 0.8rem;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: var(--radius);
  font-size: 0.875rem;
  transition: background 0.15s;
}

.nav-link:hover { background: rgba(255,255,255,0.15); }

/* ===== メインコンテンツ ===== */
main.container { padding: 2rem 1.5rem; }

/* ===== カード ===== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.card h1 {
  font-size: 1.4rem;
  margin-bottom: 0.4rem;
  color: var(--text);
}

.card .description {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1.8rem;
}

/* ===== フォーム ===== */
.form-group { margin-bottom: 1.4rem; }

label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.4rem;
  color: var(--text);
}

label .required {
  color: var(--error);
  margin-left: 0.2rem;
}

label .optional {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.8rem;
  margin-left: 0.4rem;
}

input[type="text"],
input[type="date"] {
  width: 100%;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

/* ===== ボタン ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

/* ===== 結果表示 ===== */
.result-box {
  margin-top: 1.5rem;
  padding: 1.2rem 1.4rem;
  border-radius: var(--radius);
  display: none;
}

.result-box.success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: var(--success);
}

.result-box.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--error);
}

.result-box .el-id {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.8rem;
}

.result-links { display: flex; gap: 0.8rem; flex-wrap: wrap; margin-top: 0.8rem; }

.result-link {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  text-decoration: none;
  background: var(--primary);
  color: #fff;
}

.result-link:hover { background: var(--primary-dark); }

/* ===== ダッシュボード ===== */
.page-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.4rem; }
.page-subtitle { color: var(--muted); font-size: 0.9rem; margin-bottom: 2rem; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.feature-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  text-decoration: none;
  color: var(--text);
  transition: box-shadow 0.15s, border-color 0.15s;
  display: block;
}

.feature-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border-color: var(--primary);
}

.feature-card .icon { font-size: 2rem; margin-bottom: 0.6rem; }
.feature-card h2 { font-size: 1rem; font-weight: 700; margin-bottom: 0.3rem; }
.feature-card p { font-size: 0.83rem; color: var(--muted); }

/* ===== セカンダリボタン ===== */
.btn-secondary {
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--primary);
}
.btn-secondary:hover { background: #eff6ff; }
.btn-secondary:disabled { opacity: 0.6; cursor: not-allowed; }

/* ===== ドロップダウン + ボタン横並び ===== */
.input-with-button {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.input-with-button select {
  flex: 1;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input-with-button select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

/* ===== モーダル ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  background: #fff;
  border-radius: var(--radius);
  padding: 2rem;
  width: min(400px, 90vw);
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

.modal h2 {
  font-size: 1.15rem;
  margin-bottom: 1.2rem;
}

.modal-error {
  color: var(--error);
  font-size: 0.875rem;
  margin-top: 0.4rem;
}

.modal-buttons {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.4rem;
  justify-content: flex-end;
}

/* ===== 案件一覧テーブル ===== */
.project-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.9rem;
}

.project-table th {
  background: var(--bg);
  border-bottom: 2px solid var(--border);
  padding: 0.5rem 0.8rem;
  text-align: left;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}

.project-table td {
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--border);
}

.project-table tbody tr:hover {
  background: #f8fafc;
  cursor: pointer;
}

.project-table tbody tr.selected {
  background: #eff6ff;
}

.card h2 {
  font-size: 1.1rem;
  margin-bottom: 0.4rem;
  color: var(--text);
}

.muted-text {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ===== スピナー ===== */
.spinner {
  display: inline-block;
  width: 1rem; height: 1rem;
  border: 2px solid rgba(255,255,255,0.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

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

/* ===== フッター ===== */
.site-footer {
  margin-top: 3rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
}
