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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", sans-serif;
  background: #f4f5f7;
  color: #333;
  line-height: 1.5;
}

body.centered {
  background: linear-gradient(135deg, #2c3e50, #34495e);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* ヘッダー */
.hd {
  background: #2c3e50;
  color: white;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0,0,0,.1);
}
.hd h1 { font-size: 18px; font-weight: bold; }
.hd-right { display: flex; align-items: center; gap: 12px; }
.hd-user { font-size: 13px; opacity: .8; }

main {
  max-width: 960px;
  margin: 20px auto;
  padding: 0 20px;
}

/* カード */
.card {
  background: white;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}
.card h2 { font-size: 22px; margin-bottom: 4px; }
.card h3 { font-size: 16px; margin-bottom: 12px; color: #555; }

.member-info { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.member-info code { font-family: "SF Mono", Monaco, monospace; font-size: 14px;
  color: #06C755; font-weight: bold; }

/* ボタン */
button, a.btn-primary, a.btn-secondary, a.btn-text-light, a.btn-text {
  cursor: pointer; border: none; border-radius: 6px; font-size: 14px;
  font-weight: bold; text-decoration: none; display: inline-block;
  font-family: inherit; transition: opacity .2s, background .2s;
}
button:disabled { opacity: .4; cursor: not-allowed; }

.btn-primary { background: #06C755; color: white; padding: 10px 16px; }
.btn-primary:hover:not(:disabled) { background: #05a847; color: white; }
.btn-secondary { background: #e0e0e0; color: #333; padding: 10px 16px; }
.btn-secondary:hover { background: #d0d0d0; }
.btn-text { background: transparent; color: #666; padding: 8px 12px; }
.btn-text:hover { background: rgba(0,0,0,.05); }
.btn-text-light { background: transparent; color: white; padding: 8px 12px; }
.btn-text-light:hover { background: rgba(255,255,255,.1); color: white; }
.btn-close { background: transparent; color: #999; font-size: 24px; line-height: 1; padding: 4px 8px; }
.btn-full { width: 100%; padding: 14px; font-size: 16px; margin-top: 8px; }

/* ログインフォーム */
.login-box {
  background: white; border-radius: 12px; padding: 40px 32px;
  max-width: 400px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-box h1 { text-align: center; color: #2c3e50; margin-bottom: 8px; font-size: 24px; }
.login-box .sub { text-align: center; color: #999; margin-bottom: 24px; font-size: 14px; }

/* アラート */
.alert {
  padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px;
}
.alert-success { background: #e6f7eb; color: #06C755; border-left: 4px solid #06C755; }
.alert-error { background: #fff0f0; color: #d9534f; border-left: 4px solid #d9534f; }

/* ツールバー */
.toolbar {
  display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.search {
  flex: 1; min-width: 200px; padding: 12px 16px; font-size: 16px;
  border: 1px solid #ddd; border-radius: 6px;
}
.search:focus { outline: none; border-color: #06C755; }

/* 統計バー */
.stats-bar { display: flex; gap: 16px; margin-bottom: 16px; }
.stat {
  flex: 1; background: white; padding: 16px; border-radius: 8px;
  text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.stat-label { display: block; font-size: 12px; color: #999; margin-bottom: 4px; }
.stat-value { display: block; font-size: 28px; font-weight: bold; color: #06C755; }

/* テーブル */
table {
  width: 100%; background: white; border-radius: 8px; overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.05); border-collapse: collapse;
}
thead { background: #f8f9fa; }
th {
  text-align: left; padding: 12px 16px; font-size: 12px; color: #666;
  font-weight: bold; text-transform: uppercase; letter-spacing: .5px;
}
td { padding: 14px 16px; border-top: 1px solid #f0f0f0; font-size: 14px; }
tbody tr { cursor: pointer; transition: background .15s; }
tbody tr:hover { background: #f8f9fa; }
td code {
  font-family: "SF Mono", Monaco, monospace; font-size: 12px; color: #06C755;
  background: #f0f9f4; padding: 2px 6px; border-radius: 3px;
}
td small { color: #999; font-size: 11px; }

/* バッジ */
.badge-success {
  display: inline-block; background: #e6f7eb; color: #06C755;
  font-size: 11px; padding: 3px 8px; border-radius: 10px; font-weight: bold;
}
.badge-muted {
  display: inline-block; background: #f0f0f0; color: #999;
  font-size: 11px; padding: 3px 8px; border-radius: 10px;
}
.badge-danger {
  display: inline-block; background: #fff0f0; color: #d9534f;
  font-size: 11px; padding: 3px 8px; border-radius: 10px; margin-left: 4px;
}

/* モーダル */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
}
.modal-content {
  background: white; border-radius: 10px; max-width: 500px; width: 100%;
  max-height: 90vh; overflow-y: auto;
}
.modal-header {
  padding: 20px 24px; border-bottom: 1px solid #f0f0f0;
  display: flex; justify-content: space-between; align-items: center;
}
.modal-header h2 { font-size: 18px; }
.modal-body { padding: 20px 24px; }

/* フォーム */
.form-row { margin-bottom: 16px; }
.form-row label {
  display: block; font-size: 13px; color: #555;
  margin-bottom: 6px; font-weight: bold;
}
.req { color: #d9534f; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: 10px 12px; font-size: 14px;
  border: 1px solid #ddd; border-radius: 6px; font-family: inherit;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  outline: none; border-color: #06C755;
}
.form-row textarea { resize: vertical; }
.hint { display: block; margin-top: 4px; font-size: 11px; color: #999; }
.form-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  padding-top: 16px; border-top: 1px solid #f0f0f0; margin-top: 16px;
}
.note {
  text-align: center; margin-top: 20px; font-size: 12px;
  color: #999; line-height: 1.6;
}

/* アクショングリッド */
.action-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 12px; margin-bottom: 16px;
}
.action-btn {
  background: white; padding: 20px 12px; border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; color: #333; font-size: 13px;
}
.action-btn:hover:not(:disabled) {
  background: #f8f9fa; transform: translateY(-1px);
}
.action-btn .icon { font-size: 24px; }

/* dl表示 */
dl {
  display: grid; grid-template-columns: 140px 1fr;
  gap: 8px 16px; font-size: 14px;
}
dt { color: #999; font-size: 12px; padding-top: 2px; }
dd { color: #333; word-break: break-word; }

/* リスト */
.list { display: flex; flex-direction: column; gap: 12px; }
.list-item {
  background: #f8f9fa; padding: 12px 14px;
  border-radius: 6px; font-size: 14px;
}
.list-item-main {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 4px;
}
.list-item-memo { color: #555; margin: 4px 0; line-height: 1.5; }
.list-item-meta { color: #999; font-size: 12px; margin-top: 4px; }
.amount { color: #06C755; font-weight: bold; }
.empty-text { color: #aaa; text-align: center; padding: 16px; font-size: 13px; }

/* コードボックス */
.code-box {
  background: #f8f9fa; padding: 12px 14px; border-radius: 6px;
  font-family: "SF Mono", Monaco, monospace; font-size: 13px;
  word-break: break-all; color: #06C755; border: 1px solid #e0e0e0; margin: 8px 0;
}

.empty {
  text-align: center; padding: 60px 20px;
  background: white; border-radius: 10px; margin-top: 16px;
}
.empty p { color: #999; margin-bottom: 16px; }

.link-small { text-decoration: none; font-size: 14px; }
.hidden { display: none !important; }

/* レスポンシブ */
@media (max-width: 600px) {
  main { padding: 0 12px; }
  .hd { padding: 12px 16px; }
  .hd h1 { font-size: 16px; }
  .hd-right { gap: 6px; }
  .hd-right .btn-primary, .hd-right .btn-secondary { padding: 8px 10px; font-size: 13px; }
  table { font-size: 13px; }
  th, td { padding: 10px 8px; }
  dl { grid-template-columns: 100px 1fr; font-size: 13px; }
  .action-grid { gap: 8px; }
  .action-btn { padding: 16px 8px; font-size: 12px; }
}
