:root {
  --bg: #f7f5ef;
  --surface: #ffffff;
  --line: #ddd6c8;
  --ink: #1f2937;
  --muted: #6b7280;
  --primary: #0f766e;
  --primary-strong: #0b5f59;
  --danger: #b91c1c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #fafaf9 0%, #f5f1e7 100%);
  color: var(--ink);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
}

.header {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.93);
  backdrop-filter: blur(8px);
}

.header h1 {
  margin: 0;
  font-size: 1.15rem;
}

.container {
  width: min(1120px, 94vw);
  margin: 1rem auto 2rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem;
  margin-bottom: 0.9rem;
}

.card h2,
.card h3 {
  margin-top: 0;
  margin-bottom: 0.6rem;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
}

.stat h2 {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.stat p {
  margin: 0.35rem 0 0;
  font-size: 1.45rem;
  font-weight: 700;
}

.form-grid {
  display: grid;
  gap: 0.65rem;
}

.form-grid.cols-2 {
  grid-template-columns: 1fr;
}

label {
  display: grid;
  gap: 0.28rem;
  color: var(--muted);
  font-size: 0.85rem;
}

label.check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

input,
textarea,
select,
button {
  font: inherit;
}

input,
textarea,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0.5rem 0.58rem;
  color: var(--ink);
  background: #fff;
}

textarea {
  resize: vertical;
}

label.check input {
  width: auto;
  min-height: 0;
}

button {
  border: 0;
  border-radius: 8px;
  min-height: 40px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
}

button:hover {
  background: var(--primary-strong);
}

button.danger {
  background: var(--danger);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.inline-form {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  align-items: center;
}

.inline-form > input,
.inline-form > select {
  flex: 1;
  min-width: 160px;
}

.stack {
  display: grid;
  gap: 0.8rem;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
  font-size: 0.83rem;
}

.data-table th,
.data-table td {
  border-top: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: top;
  padding: 0.52rem 0.5rem;
}

.data-table thead th {
  border-top: 0;
  background: #f8fafc;
  color: var(--muted);
}

.data-table tbody tr:nth-child(even) {
  background: #fafaf9;
}

.data-table a {
  color: #0f766e;
  font-weight: 700;
}

.action-link {
  display: inline-block;
  text-decoration: none;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #0f766e;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 0.27rem 0.56rem;
}

.action-link:hover {
  background: #f0fdfa;
}

.check-cell {
  text-align: center;
}

.check-cell input[type="checkbox"] {
  width: auto;
  min-height: 0;
}

.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  background: #e5e7eb;
  color: #334155;
  vertical-align: middle;
}

.badge.pending {
  background: #fef3c7;
  color: #92400e;
}

.badge.ok {
  background: #dcfce7;
  color: #166534;
}

.notice {
  margin-bottom: 0.8rem;
  border: 1px solid #86efac;
  background: #f0fdf4;
  color: #14532d;
  border-radius: 10px;
  padding: 0.58rem 0.72rem;
  font-weight: 600;
}

.notice.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #7f1d1d;
}

.muted {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0;
}

.span-2 {
  grid-column: 1 / -1;
}

@media (max-width: 860px) {
  .cards {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 860px) {
  .form-grid.cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
