:root {
  --bg: #f5f5f5;
  --bg-card: #ffffff;
  --bg-input: #f8f8f8;
  --border: #e0e0e0;
  --text: #1a1a1a;
  --text-muted: #777777;
  --primary: #e67e22;
  --primary-hover: #d35400;
  --primary-light: rgba(230, 126, 34, 0.08);
  --danger: #e74c3c;
  --success: #27ae60;
  --warning: #f39c12;
  --radius: 8px;
  --font: 'Segoe UI', -apple-system, sans-serif;
  --mono: 'Consolas', 'Courier New', monospace;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* レイアウト */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

.sidebar-logo {
  padding: 0 20px 20px;
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.sidebar a {
  display: block;
  padding: 10px 20px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.15s;
}

.sidebar a:hover {
  color: var(--text);
  background: var(--primary-light);
}

.sidebar a.active {
  color: var(--primary);
  background: var(--primary-light);
  border-left: 3px solid var(--primary);
  font-weight: 600;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

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

/* ヘッダー */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.page-header h1 { font-size: 22px; font-weight: 600; }

/* カード */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

/* テーブル */
table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
th { color: var(--text-muted); font-weight: 500; font-size: 12px; text-transform: uppercase; }
tr:hover td { background: var(--primary-light); }

/* ボタン */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:hover { background: var(--bg); border-color: #ccc; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: rgba(231,76,60,0.06); }
.btn-overlay { background: #6366f1; color: white; border-color: #6366f1; }
.btn-overlay:hover { background: #818cf8; border-color: #818cf8; }
.btn-sm { padding: 4px 10px; font-size: 13px; }

/* フォーム */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 500;
}

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], select, textarea {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(230, 126, 34, 0.15);
}

textarea { min-height: 100px; resize: vertical; }

/* バッジ */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.badge-published { background: rgba(39,174,96,0.1); color: var(--success); }
.badge-draft { background: rgba(243,156,18,0.1); color: var(--warning); }
.badge-system {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
}

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

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}

.modal h2 { font-size: 18px; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* セクションリスト（ドラッグ用） */
.section-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 8px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: var(--shadow);
}

.section-item .drag-handle {
  cursor: grab;
  color: var(--text-muted);
  font-size: 18px;
  user-select: none;
  padding-top: 2px;
}

.section-item .section-content { flex: 1; }
.section-item .section-title { font-weight: 600; font-size: 15px; }
.section-item .section-body {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  white-space: pre-wrap;
  max-height: 60px;
  overflow: hidden;
}

.section-item .section-note {
  font-size: 12px;
  color: var(--warning);
  margin-top: 4px;
}

.section-item .section-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* ログイン */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}

.login-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  width: 360px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.login-box h1 {
  font-size: 24px;
  text-align: center;
  margin-bottom: 8px;
  color: var(--primary);
}

.login-box p {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 24px;
}

.error-msg { color: var(--danger); font-size: 13px; margin-bottom: 12px; }

/* ユーティリティ */
.flex { display: flex; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.ml-auto { margin-left: auto; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.hidden { display: none !important; }

/* チェックボックスリスト */
.checkbox-list { max-height: 300px; overflow-y: auto; }
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 14px;
}
.checkbox-item input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }

/* タブ */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.tab {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
