* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Hiragino Sans", "Yu Gothic", sans-serif;
  background: #f4f5f7;
  color: #2c313a;
}
header {
  background: #2c313a;
  color: #fff;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.brand { font-size: 18px; font-weight: 700; padding: 14px 0; }
nav { display: flex; gap: 4px; flex-wrap: wrap; }
nav a {
  color: #c8ccd4;
  text-decoration: none;
  padding: 16px 14px;
  font-size: 14px;
  border-bottom: 3px solid transparent;
}
nav a:hover { color: #fff; }
nav a.active { color: #fff; border-bottom-color: #61AFEF; }

.user-info {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.user-name { color: #c8ccd4; }
.logout-btn {
  color: #c8ccd4;
  text-decoration: none;
  border: 1px solid #555;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
}
.logout-btn:hover { color: #fff; border-color: #aaa; }

main { max-width: 960px; margin: 24px auto; padding: 0 16px; }
h1 { font-size: 22px; margin: 0 0 18px; }

/* ===================== モバイル対応 ===================== */
@media (max-width: 600px) {
  /* ヘッダーのナビを非表示にしてボトムナビに切り替え */
  header nav { display: none; }
  header { padding: 0 16px; }
  .brand { font-size: 16px; padding: 12px 0; }
  .user-info { font-size: 12px; gap: 8px; }
  .user-name { display: none; }

  /* コンテンツ下部にボトムナビ分の余白 */
  main { margin: 16px auto 80px; padding: 0 12px; }
  h1 { font-size: 18px; margin: 0 0 14px; }

  /* ボトムナビゲーション */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #2c313a;
    border-top: 1px solid #444;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    color: #c8ccd4;
    text-decoration: none;
    font-size: 10px;
    gap: 3px;
    min-height: 56px;
  }
  .bottom-nav a .icon { font-size: 20px; line-height: 1; }
  .bottom-nav a.active { color: #61AFEF; }

  /* テーブルをスクロール可能に */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 10px; }
  table.data { font-size: 13px; }
  table.data th, table.data td { padding: 9px 8px; }

  /* カード */
  .card { padding: 14px; border-radius: 18px; }

  /* ボタン */
  .btn { padding: 11px 16px; font-size: 15px; }
  .actions { flex-wrap: wrap; }
  .actions .btn { flex: 1; text-align: center; }

  /* フォーム */
  input, select { padding: 11px 10px; font-size: 16px; /* iOSズーム防止 */ }
  .row-form { flex-direction: column; }
  .row-form label { min-width: unset; width: 100%; }

  /* 集計ツールバー */
  .toolbar { gap: 10px; }
  .total { font-size: 16px; }
}

/* PCではボトムナビを非表示 */
@media (min-width: 601px) {
  .bottom-nav { display: none; }
}

.card {
  background: #fff;
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
  margin-bottom: 18px;
}
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 720px) { .two-col { grid-template-columns: 1fr; } }

label { display: block; margin: 10px 0; font-size: 13px; color: #555; }
input, select {
  display: block;
  width: 100%;
  padding: 8px 12px;
  margin-top: 4px;
  border: 1px solid #cfd4dc;
  border-radius: 12px;
  font-size: 14px;
}
.row-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row-form label { flex: 1; min-width: 120px; margin: 0; }
.row-form button { flex: 0 0 auto; }

.btn {
  display: inline-block;
  border: none;
  background: #e3e6ea;
  color: #2c313a;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { filter: brightness(0.96); }
.btn.primary { background: #61AFEF; color: #fff; }
.btn.danger { background: #E06C75; color: #fff; }
.btn.small { padding: 4px 9px; font-size: 12px; }
.actions { margin-top: 16px; display: flex; gap: 10px; }

.preview { max-width: 100%; border-radius: 8px; }

.toolbar {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.toolbar label { margin: 0; display: flex; align-items: center; gap: 6px; }
.toolbar select { width: auto; }
.total { margin-left: auto; font-size: 18px; font-weight: 700; }

table.data, table.items { width: 100%; border-collapse: collapse; background: #fff; }
table.data { border-radius: 16px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,.07); }
table.data th, table.data td { padding: 11px 12px; text-align: left; border-bottom: 1px solid #eef0f3; font-size: 14px; }
table.data th { background: #f0f2f5; font-size: 12px; color: #555; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
table.items th, table.items td { padding: 4px; }
table.items input { margin: 0; }

.tag { background: #eef2ff; color: #4255b5; padding: 2px 9px; border-radius: 999px; font-size: 12px; }
.item-list { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: #555; }

.flash { padding: 11px 16px; border-radius: 14px; margin-bottom: 16px; font-size: 14px; }
.flash-success { background: #e4f6e7; color: #2e7d32; }
.flash-error { background: #fdeaea; color: #c62828; }

.hint { font-size: 12px; color: #888; }
.empty { color: #888; padding: 30px 0; text-align: center; }
.ok { color: #2e7d32; font-weight: 700; }
.ng { color: #c62828; font-weight: 700; }
code { background: #eef0f3; padding: 1px 5px; border-radius: 4px; }
