:root {
  --navy: #1a4b8c;
  --navy-light: #2d6cc0;
  --navy-pale: #e8eef8;
  --navy-mid: #5b89c4;
  --red: #c0392b;
  --red-pale: #fdecea;
  --gray: #9e9e9e;
  --gray-light: #f5f5f5;
  --border: #e0e0e0;
  --text: #333;
  --text-light: #666;
  --white: #fff;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,.08);
}

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

body {
  font-family: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
  background: var(--gray-light);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}

/* ── ナビゲーション ── */
.nav {
  background: var(--navy);
  color: var(--white);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0,0,0,.15);
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--white);
}
.nav-brand img { height: 44px; width: auto; filter: brightness(0) invert(1); }
.nav-title {
  font-size: 14px;
  font-weight: bold;
  color: var(--white);
  white-space: nowrap;
  letter-spacing: .02em;
}
.nav-links { display: flex; gap: 8px; align-items: center; }
.nav-links a {
  color: rgba(255,255,255,.85);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  transition: background .2s;
}
.nav-links a:hover, .nav-links a.active { background: rgba(255,255,255,.15); color: var(--white); }
.nav-links .btn-logout {
  background: rgba(255,255,255,.2);
  border: none;
  cursor: pointer;
  color: var(--white);
  font-size: 14px;
  padding: 6px 12px;
  border-radius: var(--radius);
}
.nav-name {
  font-size: 13px;
  color: rgba(255,255,255,.7);
  margin-right: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}
.link-short { display: none; }

/* ハンバーガーボタン（デスクトップでは非表示） */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  width: 36px;
  height: 36px;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--white);
  border-radius: 2px;
  transition: all .25s;
  transform-origin: center;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── レイアウト ── */
.container { max-width: 900px; margin: 0 auto; padding: 24px 16px; }
.page-title { font-size: 22px; font-weight: bold; margin-bottom: 20px; color: var(--navy); }

/* ── カード ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}

/* ── ボタン ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: opacity .2s, transform .1s;
}
.btn:hover { opacity: .85; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--navy); color: var(--white); }
.btn-danger { background: var(--red); color: var(--white); }
.btn-outline { background: var(--white); color: var(--navy); border: 1.5px solid var(--navy); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── フォーム ── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: var(--text-light); margin-bottom: 6px; font-weight: 500; }
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  transition: border-color .2s;
  background: var(--white);
}
.form-control:focus { outline: none; border-color: var(--navy); }

/* ── メッセージ ── */
.msg { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }
.msg-error { background: var(--red-pale); color: var(--red); border-left: 3px solid var(--red); }
.msg-success { background: var(--navy-pale); color: var(--navy); border-left: 3px solid var(--navy); }
.msg-info { background: #e3f2fd; color: #1565c0; border-left: 3px solid #1565c0; }

/* ── ログインページ ── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy-pale) 0%, #f5f5f5 100%);
  padding: 20px;
}
.login-box { width: 100%; max-width: 400px; }
.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo img { height: 80px; width: auto; }
.login-logo p { font-size: 14px; color: var(--text-light); margin-top: 12px; }

/* ── カレンダー ── */
.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.calendar-month { font-size: 20px; font-weight: bold; color: var(--navy); }
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-header {
  text-align: center;
  font-size: 12px;
  font-weight: bold;
  color: var(--text-light);
  padding: 6px 0;
}
.cal-header.sun { color: #c0392b; }
.cal-header.sat { color: #2471a3; }

.cal-day {
  aspect-ratio: 1;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all .15s;
  position: relative;
  min-height: 52px;
  padding: 4px;
}
.cal-day:hover:not(.closed):not(.empty) { border-color: var(--navy); background: var(--navy-pale); }
.cal-day.selected { border-color: var(--navy); background: var(--navy-pale); }
.cal-day.empty { cursor: default; }
.cal-day.closed { background: var(--gray-light); cursor: default; }
.cal-day.past { opacity: .4; cursor: default; }

.cal-day-num { font-size: 15px; font-weight: 500; line-height: 1; }
.cal-day.sun .cal-day-num { color: #c0392b; }
.cal-day.sat .cal-day-num { color: #2471a3; }

.cal-slots-badge {
  font-size: 10px;
  margin-top: 3px;
  padding: 1px 5px;
  border-radius: 10px;
  font-weight: bold;
}
.has-slots .cal-slots-badge { background: var(--navy); color: var(--white); }
.no-slots .cal-slots-badge { background: var(--border); color: var(--gray); }

/* 枠一覧パネル */
.slot-panel {
  margin-top: 20px;
  animation: slideDown .2s ease;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

.slot-panel-title { font-size: 17px; font-weight: bold; margin-bottom: 14px; color: var(--navy); }

.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }

.slot-item {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
}
.slot-item.available { border-color: var(--navy-mid); }
.slot-item.available:hover { background: var(--navy); color: var(--white); border-color: var(--navy); }
.slot-item.unavailable { background: var(--gray-light); color: var(--gray); cursor: not-allowed; }

.slot-time { font-size: 16px; font-weight: bold; }
.slot-label { font-size: 11px; margin-top: 2px; }
.slot-item.available .slot-label { color: var(--navy); }
.slot-item.available:hover .slot-label { color: rgba(255,255,255,.8); }
.slot-item.unavailable .slot-label { color: var(--gray); }

/* モーダル */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  padding: 20px;
  animation: fadeIn .15s;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: var(--white);
  border-radius: 12px;
  padding: 28px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
}
.modal h3 { font-size: 18px; font-weight: bold; margin-bottom: 16px; color: var(--navy); }
.modal-detail { background: var(--navy-pale); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 20px; }
.modal-detail p { font-size: 15px; }
.modal-detail strong { color: var(--navy); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ── マイ予約 ── */
.reservation-list { display: flex; flex-direction: column; gap: 12px; }
.reservation-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border-left: 4px solid var(--navy);
  gap: 12px;
}
.reservation-item.cancelled { border-left-color: var(--gray); opacity: .7; }
.reservation-info { flex: 1; }
.reservation-date { font-size: 16px; font-weight: bold; }
.reservation-time { font-size: 14px; color: var(--text-light); margin-top: 2px; }
.reservation-status {
  font-size: 12px;
  font-weight: bold;
  padding: 3px 8px;
  border-radius: 12px;
}
.status-confirmed { background: var(--navy-pale); color: var(--navy); }
.status-cancelled { background: var(--gray-light); color: var(--gray); }

/* ── 管理画面 ── */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 24px; }
.tab {
  padding: 10px 20px;
  cursor: pointer;
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-light);
  border: none;
  background: none;
  transition: all .15s;
}
.tab.active { background: var(--navy); color: var(--white); }
.tab:hover:not(.active) { background: var(--navy-pale); color: var(--navy); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* テーブル */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; padding: 10px 14px; background: var(--gray-light); color: var(--text-light); font-weight: 600; border-bottom: 2px solid var(--border); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
}
.badge-admin { background: #e8eaf6; color: #3949ab; }
.badge-member { background: var(--navy-pale); color: var(--navy); }
.badge-inactive { background: var(--gray-light); color: var(--gray); }
.badge-confirmed { background: var(--navy-pale); color: var(--navy); }
.badge-cancelled { background: var(--red-pale); color: var(--red); }

/* 営業時間設定 */
.hours-grid { display: grid; grid-template-columns: auto 1fr 1fr auto; gap: 12px; align-items: center; }
.hours-day { font-weight: bold; white-space: nowrap; }
.hours-closed { display: flex; align-items: center; gap: 6px; font-size: 14px; }

/* スピナー */
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading { display: flex; justify-content: center; padding: 40px; }
.empty-state { text-align: center; padding: 40px; color: var(--text-light); }

/* レスポンシブ */
@media (max-width: 600px) {
  /* ナビ */
  .nav { padding: 0 14px; position: relative; }
  .nav-brand img { height: 32px; }
  .nav-title { font-size: 11px; letter-spacing: 0; }

  /* ハンバーガー表示 */
  .hamburger { display: flex; }

  /* nav-links をドロップダウンに */
  .nav-links {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    position: absolute;
    top: 56px;
    right: 0;
    width: 220px;
    background: var(--navy);
    padding: 12px;
    box-shadow: 0 6px 16px rgba(0,0,0,.25);
    border-radius: 0 0 0 var(--radius);
    z-index: 200;
  }
  .nav-links.open { display: flex; }
  .nav-links a {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border-radius: var(--radius);
  }
  .nav-links .btn-logout {
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    font-size: 14px;
  }
  .nav-name {
    font-size: 12px;
    max-width: 100%;
    padding: 6px 12px 2px;
    color: rgba(255,255,255,.5);
  }

  .container { padding: 16px 12px; }
  .card { padding: 16px; }
  .cal-day { min-height: 44px; }
  .cal-day-num { font-size: 13px; }
  .reservation-item { flex-direction: column; align-items: flex-start; }
  .hours-grid { grid-template-columns: auto 1fr 1fr; }
  .hours-closed { grid-column: span 2; }
}
