@charset "UTF-8";

/* ============================================================ 基本 */

:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --border: #dfe3e8;
  --text: #1f2933;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --success: #059669;
  --radius: 8px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
  font-size: 15px;
  line-height: 1.7;
}

a { color: var(--primary); }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ============================================================ ヘッダー */

.site-header {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  padding-top: 12px;
  padding-bottom: 12px;
}

.brand {
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  text-decoration: none;
}

.nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.nav a {
  color: var(--text);
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}

.nav a:hover {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.header-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-name { color: var(--muted); font-size: 14px; }

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-decoration: underline;
}

main { padding: 24px 0 48px; }

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  padding: 16px 0;
}

/* ============================================================ 共通パーツ */

.page-head {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.page-title {
  font-size: 20px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  border-radius: 999px;
  padding: 2px 10px;
}

.date-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.date-form {
  display: flex;
  gap: 6px;
  align-items: center;
}

.week-range { color: var(--muted); margin: -8px 0 12px; }

.empty {
  background: var(--panel);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  color: var(--muted);
}

.flash {
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}

.flash-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.flash-error   { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.flash-info    { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

.btn {
  display: inline-block;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  padding: 6px 14px;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover { background: #f0f2f5; }

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-primary:hover { background: var(--primary-dark); }

.btn-danger {
  background: #fff;
  border-color: var(--danger);
  color: var(--danger);
}

.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-small { padding: 3px 10px; font-size: 13px; }
.btn-block { width: 100%; text-align: center; padding: 10px; }

.inline { display: inline; }
.nowrap { white-space: nowrap; }
.muted  { color: var(--muted); font-size: 13px; }

.color-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}

.tag {
  display: inline-block;
  font-size: 12px;
  border-radius: 999px;
  padding: 1px 10px;
  background: #eef1f5;
  color: var(--muted);
}

.tag-on    { background: #ecfdf5; color: var(--success); }
.tag-off   { background: #f3f4f6; color: var(--muted); }
.tag-admin { background: #eff6ff; color: var(--primary); }

/* ============================================================ カレンダー */

.table-scroll {
  overflow-x: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table.calendar {
  border-collapse: collapse;
  width: 100%;
  min-width: 640px;
}

table.calendar th,
table.calendar td {
  border: 1px solid var(--border);
  padding: 0;
}

table.calendar thead th {
  background: #fafbfc;
  padding: 8px 10px;
  font-size: 14px;
  border-top: 3px solid var(--border);
}

.facility-col { min-width: 150px; }
.facility-name { display: block; }
.facility-meta { display: block; color: var(--muted); font-size: 12px; font-weight: normal; }

.day-col { min-width: 110px; }
.day-col.is-today { background: #eff6ff; }
.day-date { display: block; }
.day-name { display: block; color: var(--muted); font-size: 12px; font-weight: normal; }

.time-col {
  width: 68px;
  background: #fafbfc;
  color: var(--muted);
  font-size: 13px;
  font-weight: normal;
  text-align: right;
  padding: 2px 8px !important;
  vertical-align: top;
}

.cell { height: 30px; vertical-align: top; }

.cell.free .add-link {
  display: block;
  min-height: 30px;
  color: transparent;
  text-align: center;
  text-decoration: none;
  line-height: 30px;
}

.cell.free:hover .add-link {
  background: #eff6ff;
  color: var(--primary);
}

.cell.booked {
  background: color-mix(in srgb, var(--facility-color, #3b82f6) 12%, #ffffff);
  border-left: 3px solid var(--facility-color, #3b82f6);
}

.booking {
  display: block;
  padding: 4px 8px;
  color: var(--text);
  text-decoration: none;
  height: 100%;
}

a.booking:hover { background: rgba(255, 255, 255, 0.5); }

.booking-title {
  display: block;
  font-weight: 600;
  font-size: 13px;
  line-height: 1.4;
}

.booking-meta {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

/* ============================================================ 月表示 */

table.month {
  border-collapse: collapse;
  width: 100%;
  min-width: 760px;
  table-layout: fixed;
}

table.month th,
table.month td {
  border: 1px solid var(--border);
}

table.month thead th {
  background: #fafbfc;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 600;
}

table.month thead th.is-sat { color: #2563eb; }
table.month thead th.is-sun { color: #dc2626; }

.month-cell {
  height: 108px;
  vertical-align: top;
  padding: 4px;
  overflow: hidden;
}

.month-cell.is-other-month { background: #fafbfc; }
.month-cell.is-other-month .month-daynum { color: #b6bcc4; }
.month-cell.is-today { background: #eff6ff; }

.month-day {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.month-daynum {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  padding: 0 2px;
}

.month-daynum:hover { text-decoration: underline; }

.month-cell.is-sat .month-daynum { color: #2563eb; }
.month-cell.is-sun .month-daynum { color: #dc2626; }

.month-cell.is-today .month-daynum {
  background: var(--primary);
  color: #fff;
  border-radius: 999px;
  min-width: 20px;
  text-align: center;
}

.month-add {
  color: transparent;
  text-decoration: none;
  font-size: 13px;
  line-height: 1;
  padding: 0 2px;
}

.month-cell:hover .month-add { color: var(--primary); }

.month-item {
  display: flex;
  align-items: baseline;
  gap: 3px;
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
  line-height: 1.5;
  padding: 1px 3px;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
}

a.month-item:hover { background: #e8edf5; }

.month-time { color: var(--muted); flex: none; }

.month-title {
  overflow: hidden;
  text-overflow: ellipsis;
}

.month-more {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-decoration: none;
  padding: 0 3px;
}

.month-more:hover { color: var(--primary); text-decoration: underline; }

/* ============================================================ 一覧表 */

table.list {
  border-collapse: collapse;
  width: 100%;
  min-width: 680px;
}

table.list th,
table.list td {
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
}

table.list thead th {
  background: #fafbfc;
  font-size: 13px;
  color: var(--muted);
}

table.list tr.is-inactive td { opacity: 0.55; }

table.list .actions { display: flex; gap: 6px; }

/* ============================================================ フォーム */

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 640px;
}

.stack { display: flex; flex-direction: column; gap: 18px; }

.field { display: flex; flex-direction: column; gap: 6px; flex: 1; }

.field label {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.field input,
.field select,
.field textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  font: inherit;
  background: #fff;
  color: var(--text);
  width: 100%;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--primary) 40%, transparent);
  border-color: var(--primary);
}

.field input[type="color"] { padding: 2px; height: 38px; }

.field-row { display: flex; gap: 16px; flex-wrap: wrap; }

.required {
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: normal;
  border-radius: 3px;
  padding: 1px 6px;
}

.hint  { color: var(--muted); font-size: 12px; margin: 0; }
.error { color: var(--danger); font-size: 13px; margin: 0; }

.form-actions { display: flex; gap: 12px; align-items: center; }
.form-note { color: var(--muted); font-size: 13px; }

.danger-zone {
  margin-top: 24px;
  max-width: 640px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ============================================================ ログイン */

.auth-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 380px;
  margin: 48px auto;
}

.auth-title { font-size: 20px; margin: 0 0 24px; text-align: center; }
.auth-note  { color: var(--muted); font-size: 12px; text-align: center; margin: 20px 0 0; }

/* ============================================================ スマホ */

@media (max-width: 640px) {
  .page-head { flex-direction: column; align-items: stretch; }
  .date-nav { margin-left: 0; }
  .card { padding: 16px; }
  .field-row { flex-direction: column; gap: 18px; }
}
