/* ============================================================
   VONS Connect — Design System v2
   モダン・スタイリッシュ / 適度なモーション
   ============================================================ */

/* ── デザイントークン ─────────────────────────────────────── */
:root {
  /* ブランド・操作色 */
  --brand-50:  #eef4ff;
  --brand-100: #dbe7fe;
  --brand-200: #bfd4fd;
  --brand-500: #3b82f6;
  --brand-600: #2563eb;
  --brand-700: #1d4ed8;

  /* サイドバー（深いインディゴ） */
  --ink-grad: linear-gradient(178deg, #1c2f74 0%, #0a1235 100%);

  /* テキスト */
  --text-1: #171e2e;
  --text-2: #535d72;
  --text-3: #98a1b3;

  /* サーフェス */
  --bg:          #f3f4f9;
  --surface:     #ffffff;
  --surface-2:   #f7f8fb;
  --line:        #e7e9f0;
  --line-strong: #d4d8e3;

  /* 状態色 */
  --danger:      #e5484d;
  --danger-bg:   #fef1f1;
  --success:     #14a06d;
  --success-bg:  #ecfdf5;
  --warning:     #e8930c;
  --warning-bg:  #fff8e8;

  /* 角丸 */
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;

  /* 影（レイヤード・ソフト） */
  --shadow-xs: 0 1px 2px rgba(18, 25, 57, 0.05);
  --shadow-sm: 0 1px 2px rgba(18, 25, 57, 0.05), 0 3px 10px rgba(18, 25, 57, 0.05);
  --shadow-md: 0 2px 4px rgba(18, 25, 57, 0.05), 0 10px 28px rgba(18, 25, 57, 0.09);
  --shadow-lg: 0 6px 16px rgba(18, 25, 57, 0.08), 0 24px 56px rgba(18, 25, 57, 0.16);

  /* モーション */
  --ease-out:    cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --t-fast: 0.15s;
  --t-base: 0.24s;
  --t-slow: 0.4s;

  /* フォーカスリング */
  --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

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

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

body {
  font-family: "Inter", "Noto Sans JP", sans-serif;
  color: var(--text-1);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--brand-100);
  color: var(--brand-700);
}

/* 控えめなカスタムスクロールバー */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #c8cdda;
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background: #aab1c4;
  border: 2px solid transparent;
  background-clip: content-box;
}

a {
  color: var(--brand-600);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
}

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── サイドバー ───────────────────────────────────────────── */
.sidebar {
  width: 220px;
  background: var(--ink-grad);
  color: rgba(255, 255, 255, 0.78);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform var(--t-base) var(--ease-out);
}
/* 上部にほのかな光彩 */
.sidebar::before {
  content: '';
  position: absolute;
  top: -120px;
  left: -60px;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(99, 140, 255, 0.28) 0%, transparent 70%);
  pointer-events: none;
}

.sidebar-header {
  padding: 22px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  position: relative;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.sidebar-logo i {
  color: #8fb0ff;
  font-size: 1.3rem;
  filter: drop-shadow(0 0 8px rgba(99, 140, 255, 0.5));
}

.sidebar-nav {
  flex: 1;
  padding: 14px 10px;
}

.sidebar-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 2px;
  border-radius: var(--r-md);
  color: rgba(255, 255, 255, 0.74);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out),
              color var(--t-fast) var(--ease-out),
              transform var(--t-fast) var(--ease-out);
  font-size: 0.9rem;
}
.sidebar-nav-item i {
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  transition: transform var(--t-base) var(--ease-spring);
}
.sidebar-nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  text-decoration: none;
  transform: translateX(2px);
}
.sidebar-nav-item:hover i {
  transform: scale(1.12);
}
.sidebar-nav-item.active {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transform: none;
}
/* アクティブ項目の左アクセントバー */
.sidebar-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  border-radius: 3px;
  background: #8fb0ff;
}

.sidebar-section-label {
  padding: 14px 12px 4px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 600;
}

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.sidebar-user {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.25);
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  color: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.5);
}

/* ── メインコンテンツ ─────────────────────────────────────── */
.main-content {
  margin-left: 220px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ガラス調スティッキーヘッダー */
.page-header {
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid var(--line);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 60px;
}

.page-header-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-header h1 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.01em;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-body {
  padding: 24px;
  flex: 1;
  animation: pageIn var(--t-slow) var(--ease-out) both;
}

/* ページ読み込み時のフェードアップ */
@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── ボタン ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out),
              border-color var(--t-fast) var(--ease-out),
              color var(--t-fast) var(--ease-out),
              box-shadow var(--t-fast) var(--ease-out),
              transform var(--t-fast) var(--ease-spring);
  white-space: nowrap;
  line-height: 1.4;
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn:active:not(:disabled) {
  transform: scale(0.97);
}
.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn-primary {
  background: linear-gradient(180deg, #3f7cf2 0%, var(--brand-600) 100%);
  color: #fff;
  border-color: var(--brand-700);
  box-shadow: 0 1px 2px rgba(13, 40, 110, 0.2), 0 3px 10px rgba(37, 99, 235, 0.25);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #4f88f5 0%, #2e6cf0 100%);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(13, 40, 110, 0.2), 0 6px 16px rgba(37, 99, 235, 0.35);
}
.btn-primary:active:not(:disabled) {
  transform: translateY(0) scale(0.97);
  box-shadow: 0 1px 2px rgba(13, 40, 110, 0.2);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
  box-shadow: 0 1px 2px rgba(160, 30, 35, 0.2);
}
.btn-danger:hover:not(:disabled) {
  background: #d63b40;
  border-color: #d63b40;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(229, 72, 77, 0.35);
}

.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
  box-shadow: 0 1px 2px rgba(10, 90, 60, 0.2);
}
.btn-success:hover:not(:disabled) {
  background: #0e8f60;
  border-color: #0e8f60;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(20, 160, 109, 0.35);
}

.btn-secondary {
  background: var(--surface);
  color: #3a4357;
  border-color: var(--line-strong);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: #b9bfd0;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
  background: rgba(18, 25, 57, 0.06);
  color: var(--text-1);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 1rem;
}

.btn-icon {
  padding: 8px;
  width: 36px;
  height: 36px;
}

.btn-icon.btn-sm {
  width: 28px;
  height: 28px;
  padding: 4px;
}

/* ── フォーム ─────────────────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #3a4357;
  margin-bottom: 6px;
}
.form-label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-control {
  display: block;
  width: 100%;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--text-1);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  transition: border-color var(--t-fast) var(--ease-out),
              box-shadow var(--t-fast) var(--ease-out),
              background var(--t-fast) var(--ease-out);
  line-height: 1.5;
}
.form-control:hover:not(:focus):not(:disabled) {
  border-color: #b9bfd0;
}
.form-control:focus {
  outline: none;
  border-color: var(--brand-600);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}
.form-control:disabled {
  background: var(--surface-2);
  color: var(--text-1);
  border-color: var(--line);
  cursor: default;
  opacity: 1;
}

.description-view {
  padding: 8px 12px;
  font-size: 0.875rem;
  color: var(--text-1);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 44px;
  transition: border-color var(--t-fast) var(--ease-out),
              background var(--t-fast) var(--ease-out);
}
.description-view:empty::before {
  content: '—';
  color: var(--text-3);
}
.description-view a {
  color: var(--brand-600);
  text-decoration: underline;
  word-break: break-all;
}
.description-view.editable {
  cursor: text;
}
.description-view.editable:hover {
  border-color: var(--brand-200);
  background: #f8fbff;
}
.form-control::placeholder {
  color: var(--text-3);
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

select.form-control {
  cursor: pointer;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text-2);
  margin-top: 4px;
}

.form-error {
  font-size: 0.78rem;
  color: var(--danger);
  margin-top: 4px;
}

.color-picker-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-option {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform var(--t-base) var(--ease-spring),
              border-color var(--t-fast) var(--ease-out),
              box-shadow var(--t-fast) var(--ease-out);
}
.color-option:hover {
  transform: scale(1.18);
}
.color-option.selected {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--text-1), var(--shadow-sm);
  transform: scale(1.1);
}

/* ── カード ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.01em;
}

.card-body {
  padding: 20px;
}

.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

/* ── モーダル ─────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(13, 18, 41, 0.48);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open {
  display: flex;
  animation: overlayIn var(--t-base) var(--ease-out);
}

@keyframes overlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.32s var(--ease-spring);
}
.modal.modal-lg {
  max-width: 680px;
}
.modal.modal-sm {
  max-width: 400px;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-1);
}

.modal-close {
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  font-size: 1rem;
  transition: background var(--t-fast) var(--ease-out),
              color var(--t-fast) var(--ease-out),
              transform var(--t-fast) var(--ease-spring);
}
.modal-close:hover {
  background: rgba(18, 25, 57, 0.07);
  color: var(--text-1);
  transform: rotate(90deg);
}

.modal-body {
  padding: 20px;
  overflow-x: hidden;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.modal-footer .modal-close {
  width: auto;
  height: auto;
  padding: 8px 16px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: #3a4357;
  font-size: 0.875rem;
  font-weight: 500;
}
.modal-footer .modal-close:hover {
  background: var(--line);
  color: var(--text-1);
  transform: none;
}

/* ── テーブル ─────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 0.875rem;
  color: var(--text-1);
}

tr:last-child td {
  border-bottom: none;
}

/* ── カレンダーナビ ───────────────────────────────────────── */
.calendar-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.calendar-nav-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-1);
  min-width: 200px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.mobile-break { display: none; }

/* ── スケジュールグリッド ─────────────────────────────────── */
.schedule-grid-wrapper {
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  overflow-y: hidden;
}
#facility-month-view {
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
#facility-month-view .schedule-grid {
  min-width: 0;
  table-layout: fixed;
  width: 100%;
}
.schedule-grid-wrapper.month-mode {
  overflow-x: hidden;
}
.schedule-grid-wrapper.month-mode .schedule-grid {
  min-width: 0;
  table-layout: fixed;
  width: 100%;
}

.facility-grid, .schedule-grid {
  border-collapse: collapse;
  width: 100%;
  min-width: 700px;
  background: var(--surface);
}
.schedule-grid {
  table-layout: fixed;
  min-width: 760px;
}
.facility-grid th, .schedule-grid th, .facility-grid td, .schedule-grid td {
  border: 1px solid var(--line);
  padding: 0;
}
.facility-grid th, .schedule-grid th {
  background: var(--surface-2);
  padding: 8px 6px;
  font-size: 0.78rem;
  text-align: center;
}

.schedule-grid .name-col {
  min-width: 120px;
  max-width: 150px;
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  background: #ffffff;
  position: sticky;
  left: 0;
  z-index: 2;
  border-left: none;
}
.schedule-grid .date-header {
  min-width: 110px;
  text-align: center;
}

.date-header .date-num {
  font-size: 1.1rem;
  font-weight: 700;
  display: block;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.date-header .date-day {
  font-size: 0.72rem;
  display: block;
}
.date-header .date-holiday {
  font-size: 0.65rem;
  display: block;
  color: #d23b3b;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.date-header.is-saturday {
  background: #eef4ff;
  color: var(--brand-600);
}
.date-header.is-sunday {
  background: #fef1f1;
  color: var(--danger);
}
.date-header.is-holiday {
  background: #fef1f1;
  color: #d23b3b;
}
.date-header.is-today {
  background: var(--warning-bg);
  box-shadow: inset 0 -2px 0 var(--warning);
}
.date-header.is-today .date-num {
  color: var(--text-1);
  font-weight: 900;
}

.schedule-cell {
  vertical-align: top;
  height: 120px;
  min-height: 120px;
  cursor: default;
  transition: background var(--t-fast) var(--ease-out);
  padding: 6px 6px 36px 6px;
  position: relative;
}
.schedule-cell[data-date] {
  cursor: pointer;
}
.schedule-cell[data-date]:hover {
  background: var(--surface-2);
}
.schedule-cell.is-saturday {
  background: #f7faff;
}
.schedule-cell.is-sunday, .schedule-cell.is-holiday {
  background: #fefafa;
}
.schedule-cell.is-today {
  background: #fffcf3;
}

.add-event-btn {
  position: absolute;
  bottom: 4px;
  right: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: var(--surface);
  color: var(--text-3);
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.7rem;
  box-shadow: var(--shadow-xs);
  transition: opacity var(--t-fast) var(--ease-out),
              transform var(--t-base) var(--ease-spring),
              color var(--t-fast) var(--ease-out),
              background var(--t-fast) var(--ease-out);
  padding: 0;
  opacity: 0;
  transform: scale(0.8);
}
.schedule-cell:hover .add-event-btn,
.month-grid-cell:hover .add-event-btn,
.facility-cell:hover .add-event-btn {
  opacity: 0.8;
  transform: scale(1);
}
.add-event-btn:hover {
  color: var(--brand-600);
  background: var(--brand-50);
  opacity: 1;
  transform: scale(1.12);
}

.event-block {
  display: block;
  margin: 5px;
  padding: 5px 8px;
  border-radius: 7px;
  font-size: 0.75rem;
  word-break: break-all;
  overflow-wrap: break-word;
  white-space: normal;
  line-height: 1.5;
  margin-bottom: 4px;
  cursor: pointer;
  color: #fff;
  font-weight: 500;
  transition: transform var(--t-fast) var(--ease-out),
              box-shadow var(--t-fast) var(--ease-out),
              filter var(--t-fast) var(--ease-out);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 1px 3px rgba(18, 25, 57, 0.18);
}
.event-block:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 4px 10px rgba(18, 25, 57, 0.22);
}
.event-block .event-time {
  display: block;
  opacity: 0.85;
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}

.time-split {
  display: flex;
  align-items: center;
  gap: 4px;
}
.time-split select {
  flex: 1;
  min-width: 0;
}
.time-colon {
  color: var(--text-2);
  font-weight: 600;
  flex-shrink: 0;
}

.member-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  background: var(--brand-600);
}

.name-cell-inner {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-list-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* ── メンバーカード ───────────────────────────────────────── */
.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.member-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: box-shadow var(--t-base) var(--ease-out),
              transform var(--t-base) var(--ease-spring),
              border-color var(--t-base) var(--ease-out);
  text-align: center;
}
.member-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--line-strong);
  transform: translateY(-3px);
}

.member-card-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  background: var(--brand-600);
  transition: transform var(--t-base) var(--ease-spring);
}
.member-card:hover .member-card-avatar {
  transform: scale(1.07);
}

.member-card-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-1);
}

.member-card-email {
  font-size: 0.8rem;
  color: var(--text-2);
  word-break: break-all;
}

.member-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
}

/* ── バッジ ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.5;
}
.badge-primary {
  background: var(--brand-50);
  color: var(--brand-600);
}
.badge-success {
  background: var(--success-bg);
  color: var(--success);
}
.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}
.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
}
.badge-gray {
  background: #eceef4;
  color: var(--text-2);
}

.tag-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 500;
}

.provisional-badge {
  display: inline-block;
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--warning);
  color: #fff;
  margin-left: 4px;
}

/* ── トースト ─────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
  pointer-events: none;
}

.toast {
  background: rgba(23, 28, 48, 0.94);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.35s var(--ease-spring);
  pointer-events: auto;
}
.toast i {
  font-size: 1rem;
  flex-shrink: 0;
}
.toast.success {
  box-shadow: inset 3px 0 0 #34d399, var(--shadow-md);
}
.toast.success i { color: #34d399; }
.toast.error {
  box-shadow: inset 3px 0 0 #f87171, var(--shadow-md);
}
.toast.error i { color: #f87171; }
.toast.warning {
  box-shadow: inset 3px 0 0 #fbbf24, var(--shadow-md);
}
.toast.warning i { color: #fbbf24; }
.toast.info {
  box-shadow: inset 3px 0 0 #60a5fa, var(--shadow-md);
}
.toast.info i { color: #60a5fa; }

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(24px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}
@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(24px);
  }
}

/* ── ローディング ─────────────────────────────────────────── */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.65);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}
.loading-overlay.show {
  display: flex;
  animation: overlayIn var(--t-fast) var(--ease-out);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--line);
  border-top-color: var(--brand-600);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.inline-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

.page-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  gap: 16px;
  color: var(--text-2);
}

/* ── ログインページ ───────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  background: #0a1235;
}

.login-page .particle-svg {
  width: 38px;
  height: 38px;
  position: absolute;
  top: 0;
  left: 0;
  transform: translateZ(0);
  pointer-events: none;
}

.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(170deg, #2a55c4 0%, #081034 100%);
  animation: hueShiftLogin 7s ease-in-out infinite alternate;
}

@keyframes hueShiftLogin {
  from { filter: hue-rotate(0deg); }
  to   { filter: hue-rotate(12deg); }
}

.login-card {
  position: relative;
  z-index: 100;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 20px;
  box-shadow: 0 24px 56px rgba(2, 8, 36, 0.4);
  padding: 52px 36px;
  width: 100%;
  max-width: 400px;
  animation: loginCardIn 0.6s var(--ease-out) both;
}

@keyframes loginCardIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ログインカード内のテキスト・フォーム */
.login-page .form-label {
  color: rgba(255, 255, 255, 0.9);
}
.login-page .form-control {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}
.login-page .form-control::placeholder {
  color: rgba(255, 255, 255, 0.4);
}
.login-page .form-control:hover:not(:focus):not(:disabled) {
  border-color: rgba(255, 255, 255, 0.4);
}
.login-page .form-control:focus {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.55);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.12);
}
.login-page #login-btn {
  background: rgba(255, 255, 255, 0.94);
  color: var(--brand-700);
  border: none;
  box-shadow: 0 4px 14px rgba(2, 8, 36, 0.3);
}
.login-page #login-btn:hover {
  background: #fff;
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(2, 8, 36, 0.4);
}
.login-page .text-muted {
  color: rgba(255, 255, 255, 0.55) !important;
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo-icon {
  width: 56px;
  height: 56px;
  background: var(--brand-600);
  border-radius: 14px;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: #fff;
  display: inline-flex;
  margin-bottom: 12px;
}

.login-logo h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.login-logo p {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.65);
  margin-top: 4px;
}

.login-error {
  background: rgba(229, 72, 77, 0.16);
  color: #ffd2d4;
  border: 1px solid rgba(229, 72, 77, 0.45);
  border-radius: var(--r-md);
  padding: 10px 12px;
  font-size: 0.85rem;
  margin-bottom: 16px;
  display: none;
}

/* ── 施設グリッド ─────────────────────────────────────────── */
.facility-grid .facility-name-col {
  min-width: 120px;
  max-width: 140px;
  padding: 8px 12px !important;
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--surface-2) !important;
  position: sticky;
  left: 0;
  z-index: 2;
  border-left: none !important;
  text-align: left !important;
}

.resource-group-row .facility-name-col {
  background: var(--brand-50) !important;
  color: var(--brand-600);
  font-size: .75rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.resource-group-row td {
  background: var(--brand-50) !important;
  color: var(--brand-600);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 4px 12px !important;
  border-top: 2px solid var(--brand-100) !important;
}

.facility-cell {
  min-width: 120px;
  vertical-align: top;
  min-height: 120px;
  cursor: default;
  padding: 6px 6px 36px 6px;
  transition: background var(--t-fast) var(--ease-out);
  position: relative;
}
.facility-cell[data-date] {
  cursor: pointer;
}
.facility-cell[data-date]:hover {
  background: var(--surface-2);
}
.facility-cell.is-saturday {
  background: #f7faff;
}
.facility-cell.is-sunday,
.facility-cell.is-holiday {
  background: #fefafa;
}
.facility-cell.is-today {
  background: #fffcf3;
}

.booking-block {
  display: block;
  padding: 5px 8px;
  border-radius: 7px;
  font-size: 0.75rem;
  line-height: 1.5;
  margin: 5px;
  margin-bottom: 4px;
  cursor: pointer;
  overflow: hidden;
  background: var(--brand-600);
  color: #fff;
  font-weight: 500;
  transition: transform var(--t-fast) var(--ease-out),
              box-shadow var(--t-fast) var(--ease-out),
              filter var(--t-fast) var(--ease-out);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 1px 3px rgba(18, 25, 57, 0.18);
}
.booking-block:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 4px 10px rgba(18, 25, 57, 0.22);
}
.booking-block.provisional {
  border: 2px dashed rgba(255, 255, 255, 0.6);
  background: rgba(232, 147, 12, 0.88) !important;
}

/* ── タブ ─────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  border-bottom: 2px solid var(--line);
  margin-bottom: 20px;
}

.tab-btn {
  padding: 10px 20px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-2);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  cursor: pointer;
  margin-bottom: -2px;
  transition: color var(--t-fast) var(--ease-out),
              border-color var(--t-fast) var(--ease-out),
              background var(--t-fast) var(--ease-out);
}
.tab-btn.active {
  color: var(--brand-600);
  border-bottom-color: var(--brand-600);
  font-weight: 600;
}
.tab-btn:hover:not(.active) {
  color: var(--text-1);
  background: rgba(18, 25, 57, 0.04);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: pageIn 0.3s var(--ease-out) both;
}

/* ── 回覧板 ───────────────────────────────────────────────── */
.circular-history-item {
  background: var(--surface);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: box-shadow var(--t-fast) var(--ease-out),
              border-color var(--t-fast) var(--ease-out);
}
.circular-history-item:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--line-strong);
}

.circular-history-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.circular-subject {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-1);
}

.circular-meta {
  font-size: 0.78rem;
  color: var(--text-2);
  white-space: nowrap;
}

.circular-recipients {
  font-size: 0.8rem;
  color: var(--text-2);
}

.attachment-upload-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-2);
  transition: border-color var(--t-fast) var(--ease-out),
              background var(--t-fast) var(--ease-out),
              color var(--t-fast) var(--ease-out);
  width: 100%;
  box-sizing: border-box;
}
.attachment-upload-label:hover {
  border-color: var(--brand-600);
  background: var(--brand-50);
  color: var(--brand-600);
}

/* ── 管理画面リスト ───────────────────────────────────────── */
.facility-list-item, .tag-list-item, .user-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: 8px;
  transition: box-shadow var(--t-fast) var(--ease-out),
              border-color var(--t-fast) var(--ease-out);
}
.facility-list-item:hover, .tag-list-item:hover, .user-list-item:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--line-strong);
}

.user-list-item {
  padding: 12px 16px;
}

.tag-list-item {
  gap: 10px;
  padding: 10px 14px;
}

.admin-group-header {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--brand-600);
  padding: 10px 4px 4px;
  margin-top: 4px;
  border-bottom: 1px solid var(--brand-100);
  margin-bottom: 4px;
}

.facility-list-item {
  gap: 10px;
  padding: 10px 14px;
}

.user-list-info {
  flex: 1;
  min-width: 0;
}

.user-list-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-1);
}

.user-list-email {
  font-size: 0.8rem;
  color: var(--text-2);
}

/* ── 検索・フィルター ─────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 7px 12px;
  flex: 1;
  max-width: 300px;
  transition: border-color var(--t-fast) var(--ease-out),
              box-shadow var(--t-fast) var(--ease-out);
}
.search-bar:focus-within {
  border-color: var(--brand-600);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}
.search-bar i {
  color: var(--text-3);
  flex-shrink: 0;
}
.search-bar input {
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 0.875rem;
  width: 100%;
  color: var(--text-1);
  background: transparent;
}
.search-bar input::placeholder {
  color: var(--text-3);
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-label {
  font-size: 0.82rem;
  color: var(--text-2);
  font-weight: 500;
  white-space: nowrap;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-2);
}
.empty-state i {
  font-size: 2.5rem;
  margin-bottom: 12px;
  display: block;
  color: var(--line-strong);
}
.empty-state p {
  font-size: 0.9rem;
}

/* ── 月カレンダー ─────────────────────────────────────────── */
.month-calendar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.month-calendar-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--line);
}

.month-day-header {
  padding: 8px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface-2);
}

.month-calendar-body {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.month-day-cell {
  min-height: 90px;
  padding: 6px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out);
}
.month-day-cell:nth-child(7n) {
  border-right: none;
}
.month-day-cell:hover {
  background: var(--surface-2);
}
.month-day-cell.other-month {
  background: var(--surface-2);
  opacity: 0.6;
}
.month-day-cell.is-today .month-day-num {
  background: var(--brand-600);
  color: #fff;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.4);
}
.month-day-cell.is-sunday .month-day-num {
  color: var(--danger);
}
.month-day-cell.is-saturday .month-day-num {
  color: var(--brand-600);
}
.month-day-cell.is-holiday {
  background: #fef1f1;
}
.month-day-cell.is-holiday .month-day-num {
  color: #d23b3b;
}

.month-day-num {
  font-size: 0.85rem;
  font-weight: 600;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}

/* ── チェックボックスリスト ───────────────────────────────── */
.checkbox-search-input {
  width: 100%;
  padding: 6px 10px;
  font-size: .82rem;
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: var(--r-md) var(--r-md) 0 0;
  outline: none;
  box-sizing: border-box;
  background: var(--surface-2);
  font-family: inherit;
  transition: background var(--t-fast) var(--ease-out),
              border-color var(--t-fast) var(--ease-out);
}
.checkbox-search-input:focus {
  border-color: var(--brand-600);
  background: var(--surface);
}
.checkbox-search-input + .checkbox-group {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 8px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background var(--t-fast) var(--ease-out);
}
.checkbox-item:hover {
  background: var(--surface-2);
}
.checkbox-item input[type=checkbox] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--brand-600);
}

.role-select {
  padding: 4px 8px;
  font-size: 0.8rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  font-family: inherit;
  cursor: pointer;
  background: var(--surface);
  transition: border-color var(--t-fast) var(--ease-out);
}
.role-select:hover {
  border-color: #b9bfd0;
}

.quick-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.quick-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 9999px;
  font-size: 0.8rem;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out),
              color var(--t-fast) var(--ease-out),
              border-color var(--t-fast) var(--ease-out),
              transform var(--t-fast) var(--ease-spring),
              box-shadow var(--t-fast) var(--ease-out);
  font-family: inherit;
}
.quick-link:hover {
  background: var(--brand-600);
  color: #fff;
  border-color: var(--brand-600);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.viewer-banner {
  background: var(--warning-bg);
  border: 1px solid #f5dfa8;
  color: #8a5a08;
  padding: 8px 16px;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-2);
  transition: background var(--t-fast) var(--ease-out);
}
.mobile-menu-btn:active {
  background: var(--surface-2);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(13, 18, 41, 0.45);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  z-index: 99;
}
.sidebar-overlay.show {
  display: block;
  animation: overlayIn var(--t-base) var(--ease-out);
}

.divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: 16px 0;
}

/* ── ユーティリティ ───────────────────────────────────────── */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-muted {
  color: var(--text-2);
}

.text-sm {
  font-size: 0.8rem;
}

.text-xs {
  font-size: 0.72rem;
}

.text-danger {
  color: var(--danger);
}

.text-success {
  color: var(--success);
}

.text-primary {
  color: var(--brand-600);
}

.fw-bold {
  font-weight: 700;
}

.fw-medium {
  font-weight: 500;
}

.d-flex {
  display: flex;
}

.d-none {
  display: none;
}

.align-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-8 {
  gap: 8px;
}

.gap-12 {
  gap: 12px;
}

.mt-4 {
  margin-top: 4px;
}

.mt-8 {
  margin-top: 8px;
}

.mt-12 {
  margin-top: 12px;
}

.mt-16 {
  margin-top: 16px;
}

.mt-20 {
  margin-top: 20px;
}

.mb-8 {
  margin-bottom: 8px;
}

.mb-12 {
  margin-bottom: 12px;
}

.mb-16 {
  margin-bottom: 16px;
}

.mb-20 {
  margin-bottom: 20px;
}

.w-full {
  width: 100%;
}

/* ── 週/月 ビュー切り替え（セグメントコントロール） ──────── */
.view-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  background: #eceef4;
  padding: 3px;
  gap: 2px;
}
.view-toggle-btn {
  padding: 4px 14px;
  font-size: 0.82rem;
  font-weight: 500;
  font-family: inherit;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out),
              color var(--t-fast) var(--ease-out),
              box-shadow var(--t-fast) var(--ease-out);
  line-height: 1.4;
}
.view-toggle-btn:first-child {
  border-right: none;
}
.view-toggle-btn.active {
  background: var(--surface);
  color: var(--brand-600);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}
.view-toggle-btn:hover:not(.active) {
  color: var(--text-1);
}

/* ── 自分行・セパレーター ───────────────────────────────────── */
.self-row .name-col {
  box-shadow: inset 3px 0 0 var(--brand-600);
}
.self-separator td {
  height: 10px;
  background: var(--bg);
  border-color: var(--bg);
  padding: 0;
}

/* ── 月グリッドセル ─────────────────────────────────────────── */
.month-grid-cell {
  vertical-align: top;
  height: 120px;
  min-height: 120px;
  padding: 6px 6px 32px 6px;
  position: relative;
  border: 1px solid var(--line);
  cursor: default;
  transition: background var(--t-fast) var(--ease-out);
}
.month-grid-cell[data-date] {
  cursor: pointer;
}
.month-grid-cell[data-date]:hover {
  background: var(--surface-2);
}
.month-grid-cell.is-saturday { background: #f7faff; }
.month-grid-cell.is-holiday  { background: #fefafa; }
.month-grid-cell.is-today {
  background: #fffcf3;
}
.month-grid-cell.other-month,
.month-grid-cell.is-other-month { background: #fafbfd; color: #c3c8d6; }
.month-cell-date {
  font-size: 0.78rem;
  font-weight: 600;
  color: #3a4357;
  margin-bottom: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-variant-numeric: tabular-nums;
}
.month-cell-date.today-num {
  background: var(--brand-600);
  color: #fff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.4);
}
.month-grid-cell.is-other-month .month-cell-date { color: #c3c8d6; }
.month-cell-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}
.booking-block.compact {
  display: block;
  font-size: 0.74rem;
  padding: 3px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5;
}
.booking-block.compact .bk-time {
  font-weight: 500;
  color: #fff;
}
.booking-block.compact .bk-facility {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.7rem;
}
.month-day-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #3a4357;
  margin-bottom: 4px;
  display: inline-block;
  width: 24px;
  height: 24px;
  line-height: 24px;
  text-align: center;
  border-radius: 50%;
}
.month-day-today {
  background: var(--brand-600);
  color: #fff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.4);
}
.month-day-sun { color: var(--danger); }
.month-day-sat { color: var(--brand-600); }

/* ── 回覧板・管理画面 2カラムレイアウト ─────────────────────── */
.circular-layout,
.admin-layout {
  display: grid;
  gap: 24px;
  align-items: start;
}
.circular-layout {
  grid-template-columns: 1fr 380px;
}
.admin-layout {
  grid-template-columns: 1fr 340px;
}

/* ── モーション抑制設定の尊重 ─────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── レスポンシブ ─────────────────────────────────────────── */
@media (max-width: 1200px) {
  .circular-layout,
  .admin-layout {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .main-content {
    margin-left: 0;
  }
  .page-body {
    padding: 16px;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .member-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  /* ハンバーガーメニューが潰れないように */
  .mobile-menu-btn {
    display: flex;
    flex-shrink: 0;
  }

  /* ページヘッダー: タイトルとアクションを2行に */
  .page-header {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 16px;
  }
  .page-header-title {
    flex: 1 1 auto;
    min-width: 0;
  }
  .page-header h1 {
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .page-header-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .search-bar {
    flex: 1;
    min-width: 0;
  }
  .search-bar input {
    width: 100%;
    min-width: 0;
  }

  /* ダッシュボード - 週ラベルの折り返しを制御 */
  .calendar-nav-title {
    font-size: 0.82rem;
    min-width: 0;
    text-align: center;
  }
  .mobile-break { display: inline; }

  /* ダッシュボード - 名前列: アバターを上・名前を下に */
  .schedule-grid .name-col {
    min-width: 68px;
    max-width: 80px;
    padding: 6px 4px;
  }
  .name-cell-inner {
    flex-direction: column;
    align-items: center;
    gap: 3px;
    text-align: center;
  }
  .name-cell-inner > div:last-child {
    font-size: 0.7rem;
    line-height: 1.3;
    word-break: break-all;
  }

  /* モーダルの横スクロール防止 */
  .modal-overlay {
    padding: 8px;
  }
  .modal-body {
    padding: 16px;
  }

  /* ダッシュボード - セル高さを抑える */
  .schedule-cell {
    height: 72px;
    min-height: 72px;
    padding: 4px 4px 24px 4px;
  }

  /* 管理画面 - ユーザーリスト: 名前行とアクション行に分割 */
  .user-list-item {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 6px 8px;
  }
  .user-list-actions {
    width: 100%;
    justify-content: flex-end;
    padding-top: 6px;
    border-top: 1px solid var(--surface-2);
    margin-top: 2px;
  }

  /* ホバーエフェクト無効化（タップ誤動作防止） */
  .event-block:hover,
  .booking-block:hover {
    opacity: 1;
    transform: none;
    filter: none;
  }
  .member-card:hover {
    transform: none;
  }

  .add-event-btn {
    opacity: 0.75;
    transform: scale(1);
    width: 18px;
    height: 18px;
    font-size: 0.55rem;
    bottom: 2px;
    right: 2px;
    border-radius: 50%;
    background: var(--surface);
    border: none;
  }

  /* iOS Safari 日付inputのはみ出し防止 */
  input[type="date"] {
    max-width: 100%;
    min-width: 0;
    -webkit-appearance: none;
    appearance: none;
  }

  /* スマホ月表示セル高さ */
  .month-grid-cell {
    height: 100px;
    min-height: 100px;
  }

  /* iOS フォームフォーカス時のズーム防止（font-size 16px以上必須） */
  .form-control,
  select.form-control,
  textarea.form-control {
    font-size: 16px;
  }

  /* 週表示のイベント・予約ブロック */
  .schedule-grid-wrapper:not(.month-mode) .event-block,
  #facility-week-view .booking-block {
    font-size: 0.7rem;
    margin: 4px;
    padding: 1px 5px;
  }

  /* 月表示のイベント・予約ブロック */
  .schedule-grid-wrapper.month-mode .event-block,
  #facility-month-view .booking-block,
  #facility-month-view .booking-block.compact {
    font-size: 0.6rem;
    margin: 2px;
    padding: 1px 3px;
    line-height: 1.3;
  }
  .schedule-grid-wrapper.month-mode .event-block .event-time,
  #facility-month-view .bk-time {
    font-size: 0.55rem;
  }
  .schedule-grid-wrapper.month-mode .event-time-end-val,
  #facility-month-view .event-time-end-val {
    display: none;
  }
}
