:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface2: #f0efe9;
  --border: rgba(0,0,0,0.08);
  --border2: rgba(0,0,0,0.14);
  --text: #1a1a18;
  --text2: #5a5a54;
  --text3: #9a9990;
  --accent: #2d5be3;
  --accent-bg: #e8edfc;
  --success: #1a7a4a;
  --success-bg: #e8f5ee;
  --warn: #b85c00;
  --warn-bg: #fff0e0;
  --danger: #c0392b;
  --danger-bg: #fdecea;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }

/* ── Sidebar layout ── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 0.5px solid var(--border2);
  display: flex;
  flex-direction: column;
  padding: 0;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  border-bottom: 0.5px solid var(--border);
  letter-spacing: -0.3px;
}
.sidebar-logo span { color: var(--accent); }

.sidebar-nav { flex: 1; padding: 12px 8px; }

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text3);
  padding: 8px 12px 4px;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border-radius: var(--radius);
  color: var(--text2);
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--accent-bg); color: var(--accent); font-weight: 500; }
.nav-item .icon { font-size: 16px; opacity: 0.85; flex-shrink: 0; }

.sidebar-footer {
  padding: 16px 8px;
  border-top: 0.5px solid var(--border);
}

/* ── Main content ── */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 52px;
  background: var(--surface);
  border-bottom: 0.5px solid var(--border2);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  flex-shrink: 0;
}
.topbar-title { font-size: 15px; font-weight: 600; flex: 1; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.content { flex: 1; padding: 24px; overflow-y: auto; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 0.5px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-size: 14px; font-weight: 600; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 0.5px solid var(--border2);
  background: var(--surface);
  color: var(--text);
  transition: background 0.15s;
  font-family: inherit;
}
.btn:hover { background: var(--surface2); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: #2451c8; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon { padding: 6px; width: 30px; height: 30px; justify-content: center; }

/* ── Form ── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--text2); margin-bottom: 5px; }
.form-control {
  width: 100%;
  padding: 8px 11px;
  border: 0.5px solid var(--border2);
  border-radius: var(--radius);
  font-size: 13.5px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s;
}
.form-control:focus { outline: none; border-color: var(--accent); }

/* ── Badge ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
}
.badge-blue { background: var(--accent-bg); color: var(--accent); }
.badge-green { background: var(--success-bg); color: var(--success); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-red { background: var(--danger-bg); color: var(--danger); }
.badge-gray { background: var(--surface2); color: var(--text2); }

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 460px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title { font-size: 15px; font-weight: 600; }

/* ── Utility ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text2); }
.text-xs { font-size: 11px; color: var(--text3); }
.w-full { width: 100%; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text3);
}
.empty-state .empty-icon { font-size: 32px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 13px; }

/* ── Stat card ── */
.stat-card {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 16px;
}
.stat-label { font-size: 11px; color: var(--text2); font-weight: 500; margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 600; letter-spacing: -0.5px; }
.stat-sub { font-size: 11px; color: var(--text3); margin-top: 3px; }

/* ── Table ── */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 0.5px solid var(--border2);
}
.table td { padding: 11px 12px; border-bottom: 0.5px solid var(--border); }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface2); }
