* { box-sizing: border-box; }
:root {
  --cb-dark: #2b2b2b;
  --cb-blue: #3f7fc1;
  --cb-blue-dark: #2f6fb5;
  --cb-blue-light: #eaf3fc;
  --cb-blue-border: #b9d3ea;
  --cb-border: #d5dde3;
  --cb-text: #333333;
  --cb-muted: #767676;
  --cb-bg: #eef1f4;
  --cb-red: #c0392b;
  --cb-green: #dff5e1;
}
body {
  margin: 0;
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", "Meiryo", -apple-system, "Segoe UI", sans-serif;
  background: var(--cb-bg);
  color: var(--cb-text);
  font-size: 14px;
}
a { color: var(--cb-blue-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.cb-page { min-height: 100vh; display: flex; flex-direction: column; }

/* トップバー */
.cb-topbar {
  background: var(--cb-dark);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1.25rem;
  gap: 1rem;
}
.cb-topbar__left { display: flex; align-items: center; gap: 1.5rem; }
.cb-topbar__logo { color: #fff; font-weight: bold; font-size: 1rem; white-space: nowrap; }
.cb-topbar__logo:hover { text-decoration: none; }
.cb-search-form { display: flex; }
.cb-search-form input {
  border: none; border-radius: 3px 0 0 3px; padding: 0.4rem 0.6rem; width: 220px; font-size: 0.85rem;
}
.cb-search-form button {
  border: none; border-radius: 0 3px 3px 0; background: #555; color: #fff; padding: 0.4rem 0.7rem; cursor: pointer;
}
.cb-topbar__right { display: flex; align-items: center; gap: 0.9rem; }
.cb-topbar__icon-link {
  position: relative; color: #f0f0f0; font-size: 1.05rem;
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border: none; cursor: pointer; font-family: inherit;
  background: linear-gradient(145deg, #545454, #262626);
  box-shadow: 0 2px 4px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.18), inset 0 -1px 2px rgba(0,0,0,0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.cb-topbar__icon-link:hover {
  color: #fff; text-decoration: none; transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.25), inset 0 -1px 2px rgba(0,0,0,0.3);
}
.cb-topbar__icon-link:active { transform: translateY(0); }
.cb-topbar__user {
  color: #fff; font-size: 0.85rem; display: flex; align-items: center; gap: 0.4rem;
  padding: 0.2rem 0.7rem 0.2rem 0.3rem; border-radius: 999px; background: rgba(255,255,255,0.08);
}
.cb-topbar__user:hover { text-decoration: none; color: #fff; background: rgba(255,255,255,0.16); }
.cb-topbar__user-icon {
  width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 0.85rem;
  background: linear-gradient(145deg, #5fa8e0, #2f6fb5);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), 0 1px 2px rgba(0,0,0,0.3);
}
.cb-topbar__logout-form { margin: 0; }
.badge {
  background: linear-gradient(145deg, #e35d4f, #c0392b); color: #fff; border-radius: 999px;
  font-size: 0.6rem; padding: 0.05rem 0.35rem; position: absolute; top: -0.3rem; right: -0.3rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

/* バナー */
.cb-banner {
  height: 56px;
  background: linear-gradient(180deg, #bcdcf2 0%, #eaf5fb 60%, #f7fbfd 100%);
  border-bottom: 1px solid var(--cb-border);
}

/* アプリアイコングリッド */
.cb-app-grid {
  display: flex; flex-wrap: wrap; gap: 0.25rem;
  background: #f7f9fb; border-bottom: 1px solid var(--cb-border);
  padding: 0.5rem 1rem;
}
.cb-app-tile {
  display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
  width: 78px; padding: 0.5rem 0.25rem; border-radius: 4px; color: var(--cb-text); font-size: 0.7rem;
  border: 1px solid transparent;
}
.cb-app-tile:hover { background: var(--cb-blue-light); text-decoration: none; }
.cb-app-tile:hover .cb-app-icon { transform: translateY(-2px); box-shadow: 0 5px 8px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.7); }
.cb-app-tile.is-active {
  background: #bfe0fa; border-color: var(--cb-blue-dark); font-weight: bold; color: var(--cb-blue-dark);
  box-shadow: inset 0 -3px 0 var(--cb-blue-dark);
}
.cb-app-tile.is-active .cb-app-icon {
  background: linear-gradient(145deg, #5fa8e0, #2c649e);
  box-shadow: 0 3px 6px rgba(47,111,181,0.5), inset 0 1px 0 rgba(255,255,255,0.4);
}
.cb-app-icon {
  font-size: 1.35rem; width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 11px; background: linear-gradient(145deg, #ffffff, #e7edf3);
  box-shadow: 0 2px 4px rgba(31,43,58,0.15), inset 0 1px 0 rgba(255,255,255,0.8), inset 0 -1px 1px rgba(31,43,58,0.05);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

/* ページタイトル */
.cb-page-title {
  padding: 0.6rem 1.5rem; font-size: 0.95rem; font-weight: bold; color: var(--cb-blue-dark);
  background: #fff; border-bottom: 1px solid var(--cb-border);
}

.cb-main { padding: 1.25rem 1.5rem; flex: 1; }
.cb-footer { text-align: center; color: var(--cb-muted); font-size: 0.75rem; padding: 1rem; }

/* ログイン画面 */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: linear-gradient(180deg, #2b2b2b 0%, #3f7fc1 100%);
}
.login-box {
  background: #fff; padding: 2.5rem; border-radius: 3px; width: 320px;
  border-top: 4px solid var(--cb-blue-dark);
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
.login-box h1 { font-size: 1.2rem; margin-top: 0; text-align: center; color: var(--cb-blue-dark); }
.login-box form { display: flex; flex-direction: column; gap: 1rem; }
.login-box label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; }
.login-box input { padding: 0.5rem; border: 1px solid var(--cb-border); border-radius: 3px; }
.login-box button {
  background: var(--cb-blue-dark); color: #fff; border: none; padding: 0.6rem; border-radius: 3px;
  cursor: pointer; font-size: 1rem;
}
.login-box button:hover { background: #244f82; }

/* パネル・フォーム共通 */
.panel { background: #fff; border: 1px solid var(--cb-border); border-radius: 3px; padding: 1.25rem; }
.panel-header {
  display: flex; align-items: center; justify-content: space-between; margin: -1.25rem -1.25rem 1rem;
  padding: 0.75rem 1.25rem; background: var(--cb-blue-light); border-bottom: 1px solid var(--cb-blue-border);
}
.panel-header h1 { margin: 0; font-size: 1rem; color: var(--cb-blue-dark); border: none; padding: 0; }
.panel h1 { font-size: 1rem; color: var(--cb-blue-dark); border-bottom: 1px solid var(--cb-border); padding-bottom: 0.5rem; }
.panel h2 { font-size: 0.9rem; color: var(--cb-blue-dark); }

.stacked-form { display: flex; flex-direction: column; gap: 1rem; max-width: 480px; }
.stacked-form label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; }
.stacked-form input, .stacked-form select, .stacked-form textarea {
  padding: 0.5rem; border: 1px solid var(--cb-border); border-radius: 3px; font-family: inherit; font-size: 0.9rem;
}
.stacked-form input[type="color"] { width: 70px; height: 38px; padding: 0.2rem; cursor: pointer; }
.checkbox-label { flex-direction: row !important; align-items: center; gap: 0.5rem !important; }
.form-actions { display: flex; gap: 0.75rem; }

/* 予定登録フォーム（Cybozu風） */
.cb-form-panel { padding: 0; overflow: hidden; }
.cb-form-panel__header {
  background: var(--cb-blue-dark); color: #fff; font-weight: bold; font-size: 1rem;
  padding: 0.75rem 1.25rem; border-radius: 2px 2px 0 0;
}
.cb-form { padding: 1.25rem; display: flex; flex-direction: column; gap: 0; }
.cb-form-row {
  display: flex; align-items: center; gap: 1rem; padding: 0.6rem 0; border-bottom: 1px dashed var(--cb-border);
}
.cb-form-row--top { align-items: flex-start; }
.cb-form-row__label {
  flex: 0 0 90px; font-size: 0.85rem; font-weight: bold; color: var(--cb-text); padding-top: 0.3rem;
}
.cb-form-row--top .cb-form-row__label { padding-top: 0.5rem; }
.cb-form-row__content { flex: 1; display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.cb-form-row__content input[type="text"],
.cb-form-row__content input[type="date"],
.cb-form-row__content input[type="time"],
.cb-form-row__content select,
.cb-form-row__content textarea {
  padding: 0.45rem 0.6rem; border: 1px solid var(--cb-border); border-radius: 3px; font-family: inherit; font-size: 0.88rem;
}
.cb-form-row__content textarea { width: 100%; max-width: 480px; }
.cb-form-row__content--time { gap: 0.4rem; }
.cb-form-time-sep { color: var(--cb-muted); }
.cb-form-row__content--schedule select { min-width: 100px; }
.cb-form-row__content--schedule input[type="text"] { flex: 1; min-width: 220px; }
.cb-form-inline-checkbox { margin-left: 0.5rem; font-size: 0.85rem; }
.cb-form-actions-content { gap: 0.75rem; }

/* デュアルリストボックス（参加者・施設） */
.dual-listbox { display: flex; align-items: flex-start; gap: 0.6rem; flex-wrap: wrap; }
.dual-listbox__selected .dual-listbox__list {
  width: 220px; height: 180px; padding: 0.3rem; font-size: 0.82rem;
}
.dual-listbox__buttons { display: flex; flex-direction: column; gap: 0.4rem; padding-top: 0.5rem; }
.dual-listbox__buttons button {
  border: 1px solid var(--cb-border); background: #fff; border-radius: 3px; cursor: pointer;
  padding: 0.35rem 0.6rem; font-size: 0.78rem; white-space: nowrap;
}
.dual-listbox__buttons button:hover { background: var(--cb-blue-light); border-color: var(--cb-blue-border); }
.dual-listbox__candidates { display: flex; flex-direction: column; gap: 0.35rem; }
.dual-listbox__search { padding: 0.35rem 0.5rem; border: 1px solid var(--cb-border); border-radius: 3px; font-size: 0.82rem; width: 220px; }
.dual-listbox__group-filter { padding: 0.35rem 0.5rem; border: 1px solid var(--cb-border); border-radius: 3px; font-size: 0.82rem; width: 220px; }
.dual-listbox__candidates .dual-listbox__list { width: 220px; height: 140px; padding: 0.3rem; font-size: 0.82rem; }
.form-error { color: var(--cb-red); background: #fdecec; border: 1px solid #f3b8b8; padding: 0.5rem 0.75rem; border-radius: 3px; }
.form-success { color: #1a7a3f; background: #e8f7ee; border: 1px solid #b7e3c6; padding: 0.5rem 0.75rem; border-radius: 3px; }

button, .btn-primary, .btn-secondary, .btn-cancel, .btn-danger {
  cursor: pointer; border-radius: 3px; padding: 0.5rem 1.1rem; font-size: 0.85rem; border: 1px solid transparent;
  display: inline-block;
}
button[type="submit"], .btn-primary { background: var(--cb-blue-dark); color: #fff; }
button[type="submit"]:hover, .btn-primary:hover { background: #244f82; }
.btn-secondary { background: #fff; color: var(--cb-blue-dark); border-color: var(--cb-blue-border); }
.btn-cancel { background: #fff; color: var(--cb-text); border-color: var(--cb-border); }
.btn-danger { background: #fff; color: var(--cb-red); border-color: #eab8b8; }
.btn-danger:hover { background: #fdecec; }
.delete-form { margin-top: 1rem; }
.link-btn { background: none; border: none; color: var(--cb-blue-dark); padding: 0; font-size: inherit; cursor: pointer; }

/* カレンダー（フル画面） */
.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; flex-wrap: wrap; gap: 0.75rem; }
.calendar-scope {
  display: flex; align-items: center; gap: 1rem; background: var(--cb-blue-light);
  padding: 0.6rem 1rem; border: 1px solid var(--cb-blue-border); border-radius: 3px; font-size: 0.85rem;
}
#calendar { background: #fff; border: 1px solid var(--cb-border); border-radius: 3px; padding: 1rem; }

.event-type-legend { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin-bottom: 0.75rem; font-size: 0.8rem; color: var(--cb-muted); }
.event-type-legend__item { display: inline-flex; align-items: center; }

.fc { --fc-border-color: var(--cb-border); --fc-today-bg-color: #fff6da; --fc-button-bg-color: var(--cb-blue-dark); --fc-button-border-color: var(--cb-blue-dark); --fc-button-hover-bg-color: #244f82; --fc-button-hover-border-color: #244f82; --fc-button-active-bg-color: #244f82; font-size: 0.95rem; }
.fc .fc-col-header-cell { background: var(--cb-blue-light); padding: 0.4rem 0; }
.fc .fc-col-header-cell-cushion { font-size: 0.85rem; font-weight: bold; color: var(--cb-text); }
.fc .fc-daygrid-day-number { font-size: 0.9rem; padding: 0.35rem 0.5rem; }
.fc-event { background: var(--cb-blue); border-color: var(--cb-blue); font-size: 0.78rem; padding: 1px 3px; border-radius: 3px; }
.fc .fc-daygrid-day-frame { min-height: 90px; }

.fc-event-custom-content { display: flex; align-items: center; gap: 3px; overflow: hidden; }
.fc-event-type-badge {
  flex: 0 0 auto; color: #fff; border: 1px solid rgba(255,255,255,0.85); border-radius: 3px;
  padding: 0 4px; font-size: 0.62rem; line-height: 1.4; white-space: nowrap;
}
.fc-event-custom-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; }

/* 週末・祝日の強調 */
.fc .fc-col-header-cell.fc-day-sun .fc-col-header-cell-cushion,
.fc .fc-daygrid-day.fc-day-sun .fc-daygrid-day-number { color: var(--cb-red); }
.fc .fc-col-header-cell.fc-day-sat .fc-col-header-cell-cushion,
.fc .fc-daygrid-day.fc-day-sat .fc-daygrid-day-number { color: var(--cb-blue-dark); }
.fc .fc-daygrid-day.fc-day-sun { background: #fdf3f3; }
.fc .fc-daygrid-day.fc-day-sat { background: #f3f8fd; }
.fc .fc-daygrid-day.fc-day-holiday { background: #fbe8e8; }
.fc .fc-daygrid-day.fc-day-holiday .fc-daygrid-day-number { color: var(--cb-red); font-weight: bold; }
.fc-holiday-label {
  font-size: 0.65rem; color: var(--cb-red); padding: 0 0.4rem; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fc .fc-daygrid-day.fc-day-today { background: var(--fc-today-bg-color); box-shadow: inset 0 0 0 2px #f0c545; }

/* 掲示板 */
.bulletin-list { list-style: none; padding: 0; margin: 0; }
.bulletin-item { border-bottom: 1px solid var(--cb-border); }
.bulletin-item a { display: flex; flex-direction: column; gap: 0.2rem; padding: 0.75rem 0.25rem; color: inherit; }
.bulletin-item a:hover { background: var(--cb-blue-light); text-decoration: none; }
.bulletin-item.is-pinned { background: #fff8e6; }
.pin-badge { display: inline-block; background: var(--cb-red); color: #fff; font-size: 0.65rem; padding: 0.1rem 0.4rem; border-radius: 2px; width: fit-content; margin-right: 0.3rem; }
.bulletin-title { font-weight: bold; }
.bulletin-meta { font-size: 0.75rem; color: var(--cb-muted); }
.bulletin-body { white-space: pre-wrap; line-height: 1.7; margin: 1rem 0; }
.bulletin-detail-header { margin-bottom: 1rem; border-bottom: 1px solid var(--cb-border); padding-bottom: 0.75rem; }

/* 通知 */
.notification-list { list-style: none; padding: 0; margin: 0; }
.notification-item { border-bottom: 1px solid var(--cb-border); }
.notification-item.is-unread { background: var(--cb-blue-light); }
.notification-link-btn {
  display: flex; justify-content: space-between; width: 100%; background: none; border: none;
  padding: 0.75rem 0.5rem; text-align: left; cursor: pointer; font-size: 0.85rem; font-family: inherit;
}
.notification-date { color: var(--cb-muted); font-size: 0.75rem; }

/* 管理画面テーブル */
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.admin-table th {
  text-align: left; padding: 0.6rem; background: var(--cb-blue-light);
  border: 1px solid var(--cb-blue-border); color: var(--cb-blue-dark);
}
.admin-table td { text-align: left; padding: 0.6rem; border: 1px solid var(--cb-border); }
.admin-table tr.is-inactive { color: #9ca3af; }
.admin-table__actions { display: flex; gap: 0.75rem; }
.user-furigana { display: block; font-size: 0.72rem; color: var(--cb-muted); }
.user-updated-at { font-size: 0.75rem; color: var(--cb-muted); white-space: nowrap; }
.color-swatch {
  display: inline-block; width: 16px; height: 16px; border-radius: 4px; vertical-align: middle;
  border: 1px solid rgba(0,0,0,0.15); margin-right: 0.3rem;
}

/* 予定メニューの設定（Cybozu風） */
.event-type-panel { overflow: hidden; }
.event-type-panel__header {
  background: var(--cb-blue-dark); color: #fff; font-weight: bold; font-size: 1rem;
  padding: 0.75rem 1.25rem; margin: -1.25rem -1.25rem 0; border-radius: 2px 2px 0 0;
}
.event-type-panel__toolbar {
  background: var(--cb-blue-light); padding: 0.5rem 1.25rem; margin: 0 -1.25rem 1rem;
  border-bottom: 1px solid var(--cb-blue-border); display: flex; gap: 1rem; font-size: 0.85rem;
}
.event-type-panel__empty { color: var(--cb-muted); }
.event-type-table__order { display: flex; gap: 0.25rem; }
.order-form { margin: 0; }
.order-form button {
  border: 1px solid var(--cb-border); background: #fff; border-radius: 3px; cursor: pointer;
  padding: 0.15rem 0.4rem; font-size: 0.7rem; color: var(--cb-muted);
}
.order-form button:hover:not(:disabled) { background: var(--cb-blue-light); color: var(--cb-blue-dark); }
.order-form button:disabled { opacity: 0.3; cursor: default; }
.event-type-action { font-size: 0.85rem; }
.event-type-action--edit { color: var(--cb-blue-dark); }
.event-type-action--delete {
  background: none; border: none; color: var(--cb-red); cursor: pointer; font-size: 0.85rem; padding: 0; font-family: inherit;
}

/* ToDoリスト */
.todo-table tr.is-done { color: #9ca3af; }
.todo-table tr.is-done a { color: #9ca3af; text-decoration: line-through; }
.priority-stars { color: #e0a739; letter-spacing: 1px; white-space: nowrap; }
.todo-memo { color: var(--cb-muted); font-size: 0.8rem; max-width: 240px; }
.form-hint { font-size: 0.8rem; color: var(--cb-muted); margin: -0.4rem 0 0; }

.todo-check-form { margin: 0; }
.todo-check {
  width: 18px; height: 18px; border: 1px solid var(--cb-border); border-radius: 3px;
  background: #fff; cursor: pointer; padding: 0; line-height: 1; color: var(--cb-blue-dark); font-size: 0.75rem;
}
.todo-check:hover { border-color: var(--cb-blue-dark); }
.todo-check.is-checked { background: var(--cb-blue-dark); color: #fff; }

.portal-todo-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.portal-todo-list li {
  display: flex; align-items: center; gap: 0.5rem; font-size: 0.82rem;
  padding-bottom: 0.5rem; border-bottom: 1px dashed var(--cb-border);
}
.portal-todo-list li:last-child { border-bottom: none; padding-bottom: 0; }
.portal-todo-list a { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 電話メモ */
.phone-memo-message { max-width: 220px; color: var(--cb-text); }
.phone-memo-table tr.is-confirmed { color: #9ca3af; }
.phone-memo-table tr.is-confirmed td { color: #9ca3af; }
.confirmed-badge { color: #1a7a3f; font-size: 0.8rem; white-space: nowrap; }
.unconfirmed-badge { color: var(--cb-red); font-size: 0.8rem; white-space: nowrap; }

/* ポータル（トップページ） */
.portal-week-widget { margin-bottom: 1rem; }
.portal-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; align-items: start; }
.portal-col { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }

.portal-widget { background: #fff; border: 1px solid var(--cb-border); border-radius: 3px; overflow: hidden; }
.portal-widget__header {
  margin: 0; background: var(--cb-blue-light); color: var(--cb-blue-dark);
  padding: 0.18rem 0.9rem; font-size: 0.8rem; border-bottom: 1px solid var(--cb-blue-border);
  display: flex; align-items: center; gap: 0.4rem;
}
.portal-widget__icon { font-size: 0.9rem; }
.portal-widget__body { padding: 0.75rem 0.9rem; }
.portal-widget__more { display: block; text-align: right; font-size: 0.78rem; margin-top: 0.5rem; }
.portal-week-widget__more { margin-left: auto; }
.portal-empty { color: var(--cb-muted); font-size: 0.85rem; margin: 0.25rem 0; }

/* 横一週間スケジュール */
.portal-week-widget__body { padding: 0.75rem; overflow-x: auto; }

.portal-week-groupbar { margin-bottom: 0.6rem; }
.portal-week-groupbar__label {
  display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: var(--cb-muted);
}
.portal-week-group-select {
  padding: 0.3rem 0.5rem; border: 1px solid var(--cb-border); border-radius: 3px; font-size: 0.85rem; background: #fff;
}

.portal-week-nav {
  display: flex; flex-wrap: wrap; flex-direction: column; align-items: center;
  gap: 0.3rem; margin-bottom: 0.75rem; text-align: center;
}
.portal-week-nav__date {
  font-size: 1.05rem; font-weight: bold; color: #1a1a1a; white-space: nowrap;
}
.portal-week-nav__buttons { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: center; }
.portal-week-nav__buttons a {
  font-size: 0.78rem; padding: 0.25rem 0.65rem; border: 1px solid #d0d0d0; border-radius: 3px;
  color: #6b6b6b; background: #f0f0f0; white-space: nowrap;
}
.portal-week-nav__buttons a:hover { background: #e2e2e2; border-color: #bbb; color: #444; text-decoration: none; }

.portal-week { width: 100%; border-collapse: collapse; table-layout: fixed; min-width: 700px; }
.portal-week th {
  font-size: 0.75rem; font-weight: bold; color: var(--cb-muted);
  padding: 0.4rem 0.3rem; border: 1px solid var(--cb-border); background: #f7f9fb; white-space: nowrap;
}
.portal-week th.is-sun { color: var(--cb-red); }
.portal-week th.is-sat { color: var(--cb-blue-dark); }
.portal-week th.is-holiday { color: var(--cb-red); background: #fbe8e8; }
.portal-week th.is-today { background: var(--cb-blue-light); color: var(--cb-blue-dark); font-weight: bold; }
.portal-week__holiday-name {
  display: block; font-size: 0.62rem; font-weight: normal; color: var(--cb-red);
  overflow: hidden; text-overflow: ellipsis;
}
.portal-week__weather { display: inline-block; font-size: 0.95rem; margin-left: 0.15rem; cursor: default; }
.portal-week__daynum { font-weight: bold; font-size: 0.9rem; color: var(--cb-text); }
.portal-week th.is-sun .portal-week__daynum { color: var(--cb-red); }
.portal-week th.is-sat .portal-week__daynum { color: var(--cb-blue-dark); }
.portal-week th.is-holiday .portal-week__daynum { color: var(--cb-red); }
.portal-week th.is-today .portal-week__daynum { color: var(--cb-blue-dark); }
.portal-week td {
  vertical-align: top; border: 1px solid var(--cb-border); padding: 0.4rem 0.3rem; height: 90px; width: 14.28%;
}
.portal-week td.is-today { background: #fffbea; }
.portal-week td.is-holiday { background: #fdf3f3; }
.portal-week__empty { color: #c3c9ce; font-size: 0.8rem; margin: 0.2rem 0; text-align: center; }

/* グループ表示（部署メンバー横並び） */
.portal-week--group th.portal-week__member-col { width: 90px; background: #f0f2f4; }
.portal-week--group td, .portal-week--group th { height: auto; }
.portal-week--group td { min-height: 56px; }
.portal-week__member-name {
  font-size: 0.8rem; font-weight: bold; color: var(--cb-text); background: #f7f9fb;
  vertical-align: middle !important; white-space: nowrap;
}
.portal-week__member-dept { display: block; font-size: 0.65rem; font-weight: normal; color: var(--cb-muted); }
.portal-week__empty-row { text-align: center; color: var(--cb-muted); font-size: 0.85rem; padding: 1rem; }
.portal-week--group .portal-week__events li { color: var(--cb-text); }
.portal-week__events { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.25rem; }
.portal-week__events li { font-size: 0.75rem; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.portal-week__events a { display: inline; }
.event-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 0.3rem; vertical-align: middle; }
.event-type-badge {
  display: inline-block; color: #fff; border: 1px solid rgba(255,255,255,0.85); border-radius: 3px;
  padding: 0 4px; font-size: 0.62rem; line-height: 1.4; white-space: nowrap; margin-right: 0.3rem; vertical-align: middle;
}
.portal-week__add {
  display: block; text-align: center; color: var(--cb-muted); font-size: 0.8rem; margin-top: 0.35rem; border-radius: 3px;
}
.portal-week__add:hover { background: var(--cb-blue-light); color: var(--cb-blue-dark); text-decoration: none; }

.portal-event-list, .portal-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.portal-event-list li, .portal-list li {
  display: flex; align-items: baseline; gap: 0.5rem; font-size: 0.82rem;
  padding-bottom: 0.5rem; border-bottom: 1px dashed var(--cb-border);
}
.portal-event-list li:last-child, .portal-list li:last-child { border-bottom: none; padding-bottom: 0; }
.portal-event-date { color: var(--cb-blue-dark); font-weight: bold; flex: 0 0 auto; }
.portal-list li.is-unread a { font-weight: bold; }
.portal-meta { color: var(--cb-muted); font-size: 0.72rem; margin-left: auto; white-space: nowrap; }

/* ミニカレンダー */
.mini-calendar { width: 100%; border-collapse: collapse; margin-bottom: 1rem; font-size: 0.8rem; }
.mini-calendar:last-child { margin-bottom: 0; }
.mini-calendar caption { text-align: left; font-weight: bold; color: var(--cb-blue-dark); padding-bottom: 0.4rem; font-size: 0.9rem; }
.mini-calendar th { padding: 0.3rem; color: var(--cb-muted); font-weight: bold; font-size: 0.75rem; }
.mini-calendar th.is-sun { color: var(--cb-red); }
.mini-calendar th.is-sat { color: var(--cb-blue-dark); }
.mini-calendar td { text-align: center; padding: 0.15rem; }
.mini-calendar td.is-sun a { color: var(--cb-red); }
.mini-calendar td.is-sat a { color: var(--cb-blue-dark); }
.mini-calendar td.is-holiday a { color: var(--cb-red); font-weight: bold; background: #fdeaea; }
.mini-calendar td a { display: block; border-radius: 3px; color: inherit; padding: 0.25rem 0; cursor: pointer; }
.mini-calendar td a:hover { background: var(--cb-blue-light); text-decoration: none; }
.mini-calendar td.is-today a { background: var(--cb-green); font-weight: bold; box-shadow: inset 0 0 0 1px #6fbf87; }

@media (max-width: 900px) {
  .portal-grid { grid-template-columns: 1fr; }
}

/* 設備予約 管理画面 */
.facility-admin-body { padding: 1.25rem; display: flex; flex-direction: column; gap: 1.5rem; }
.facility-group-block { border: 1px solid var(--cb-border); border-radius: 3px; padding: 1rem; }
.facility-group-block--new { background: var(--cb-blue-light); border-style: dashed; }
.facility-group-block__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.facility-group-block__header h2 { margin: 0; font-size: 0.95rem; color: var(--cb-blue-dark); }
.facility-group-block h2 { margin: 0 0 0.75rem; font-size: 0.95rem; color: var(--cb-blue-dark); }
.facility-add-form { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.facility-add-form input { flex: 1; padding: 0.45rem 0.6rem; border: 1px solid var(--cb-border); border-radius: 3px; font-size: 0.85rem; }

/* 設備予約 一覧画面 */
.facility-toolbar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.facility-toolbar select { padding: 0.4rem 0.6rem; border: 1px solid var(--cb-border); border-radius: 3px; font-size: 0.85rem; }
.facility-view-tabs { display: flex; gap: 0.3rem; }
.facility-view-tabs a {
  padding: 0.35rem 0.9rem; border: 1px solid var(--cb-border); border-radius: 3px; font-size: 0.82rem; color: var(--cb-text); background: #fff;
}
.facility-view-tabs a.is-active { background: var(--cb-blue-dark); color: #fff; border-color: var(--cb-blue-dark); font-weight: bold; }
.facility-view-tabs a:hover { text-decoration: none; background: var(--cb-blue-light); }
.facility-view-tabs a.is-active:hover { background: var(--cb-blue-dark); }

.facility-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.facility-table th {
  font-size: 0.75rem; font-weight: bold; color: var(--cb-muted);
  padding: 0.4rem 0.3rem; border: 1px solid var(--cb-border); background: #f7f9fb; white-space: nowrap;
}
.facility-table th.is-today { background: var(--cb-blue-light); color: var(--cb-blue-dark); }
.facility-table td {
  vertical-align: top; border: 1px solid var(--cb-border); padding: 0.4rem 0.3rem; height: 90px;
}
.facility-table td.is-today { background: #fffbea; }
.facility-table__facility-name {
  font-size: 0.8rem; font-weight: bold; background: #f7f9fb; white-space: nowrap; vertical-align: middle !important;
}
.facility-reservation-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.facility-reservation-list li {
  font-size: 0.75rem; line-height: 1.35; padding: 0.2rem 0.3rem; border-radius: 3px;
  background: var(--cb-blue-light); border-left: 3px solid var(--cb-blue-dark);
}
.facility-reservation-list li a { display: block; color: var(--cb-text); }
.facility-reservation-time { font-weight: bold; color: var(--cb-blue-dark); display: block; }
.facility-reservation-memo { color: var(--cb-muted); font-size: 0.7rem; }
.facility-add-slot {
  display: block; text-align: center; color: var(--cb-muted); font-size: 0.75rem; margin-top: 0.3rem; border-radius: 3px;
}
.facility-add-slot:hover { background: var(--cb-blue-light); color: var(--cb-blue-dark); text-decoration: none; }

.facility-month-list { display: flex; flex-direction: column; gap: 0.75rem; }
.facility-month-day { border: 1px solid var(--cb-border); border-radius: 3px; overflow: hidden; }
.facility-month-day__header {
  background: var(--cb-blue-light); color: var(--cb-blue-dark); font-weight: bold; font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
}
.facility-month-day__header.is-today { background: var(--cb-blue-dark); color: #fff; }
.facility-month-day__body { padding: 0.6rem 0.75rem; display: flex; flex-direction: column; gap: 0.4rem; }
.facility-month-item { font-size: 0.82rem; display: flex; gap: 0.5rem; align-items: baseline; flex-wrap: wrap; }
.facility-month-item__facility {
  display: inline-block; background: var(--cb-blue-dark); color: #fff; border-radius: 3px; padding: 0 0.4rem; font-size: 0.7rem;
}

/* タイムカード */
.timecard-toolbar { display: flex; gap: 1.5rem; margin-bottom: 0.75rem; font-size: 0.85rem; }
.timecard-panel { padding: 0; overflow: hidden; }
.timecard-panel__header {
  background: var(--cb-blue-dark); color: #fff; font-weight: bold; font-size: 1rem;
  padding: 0.75rem 1.25rem; border-radius: 2px 2px 0 0;
}
.timecard-nav { padding: 1rem 1.25rem 0; margin-bottom: 0.75rem; }
.timecard-table { width: 100%; margin: 0 0 1.25rem; }
.timecard-table th { text-align: center; }
.timecard-table td { text-align: center; }
.timecard-table td:first-child { text-align: left; }
.timecard-table tr.is-sat-row td { background: #eaf3fc; }
.timecard-table tr.is-sun-row td { background: #fdeeee; }
.timecard-table tr.is-today-row td { background: #eefbe8; }
.timecard-table td.is-sun { color: var(--cb-red); }
.timecard-table td.is-sat { color: var(--cb-blue-dark); }
.timecard-punch-btn {
  background: #fff; border: 1px solid var(--cb-blue-border); color: var(--cb-blue-dark);
  border-radius: 3px; padding: 0.3rem 0.7rem; font-size: 0.8rem; cursor: pointer;
}
.timecard-punch-btn:hover { background: var(--cb-blue-light); }
.timecard-remarks-cell { display: flex; align-items: center; justify-content: center; gap: 0.4rem; }
.timecard-remarks-text { font-size: 0.78rem; color: var(--cb-muted); }
.timecard-edit-link {
  display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px;
  border-radius: 50%; background: #1a7a3f; color: #fff; font-size: 0.7rem; flex: 0 0 auto;
}
.timecard-edit-link:hover { background: #145c30; text-decoration: none; }

/* 在籍一覧 */
.roster-table th, .roster-table td { text-align: left; }
.status-badge { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.78rem; font-weight: bold; }
.status-absent { background: #eee; color: #767676; }
.status-present { background: #e8f7ee; color: #1a7a3f; }
.status-out { background: #fff6da; color: #9a6b00; }
.status-left { background: #eef1f4; color: #555; }

/* ポータルのタイムカードウィジェット */
.portal-timecard-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.portal-timecard-table th {
  font-size: 0.75rem; font-weight: normal; color: var(--cb-muted); text-align: center; padding: 0.2rem 0;
}
.portal-timecard-table td { text-align: center; padding: 0.25rem 0.1rem; }
.portal-timecard-table td form { margin: 0; }
.portal-timecard__time { font-size: 0.85rem; font-weight: bold; color: var(--cb-text); }
.portal-timecard__dash { color: #c3c9ce; }
.timecard-punch-btn:disabled { color: #bbb; background: #f5f5f5; border-color: #e0e0e0; cursor: default; }

/* リンク集 */
.link-list { list-style: none; margin: 0 0 1.5rem; padding: 0; }
.link-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.5rem 0.25rem; border-bottom: 1px solid var(--cb-border); font-size: 0.88rem;
}
.link-list__actions { display: flex; gap: 0.6rem; font-size: 0.78rem; flex: 0 0 auto; }
.portal-link-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.portal-link-list li { font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portal-link-section-title { font-size: 0.72rem; font-weight: bold; color: var(--cb-muted); margin: 0.6rem 0 0.3rem; }
.portal-link-section-title:first-child { margin-top: 0; }

/* アドレス帳 */
.addr-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.75rem; flex-wrap: wrap; }
.addr-search-form { display: flex; gap: 0.5rem; }
.addr-search-form input { padding: 0.45rem 0.6rem; border: 1px solid var(--cb-border); border-radius: 3px; font-size: 0.85rem; width: 220px; }
.addr-tabs { display: flex; gap: 0.25rem; margin-bottom: 0.75rem; }
.addr-tab {
  padding: 0.45rem 1.1rem; border: 1px solid var(--cb-border); border-bottom: none; border-radius: 4px 4px 0 0;
  background: #f0f2f4; color: var(--cb-text); font-size: 0.85rem;
}
.addr-tab.is-active { background: #fff; color: var(--cb-blue-dark); font-weight: bold; border-color: var(--cb-blue-border); }
.addr-tab:hover { text-decoration: none; background: var(--cb-blue-light); }

.addr-layout { display: flex; gap: 1rem; align-items: flex-start; }
.addr-sidebar {
  flex: 0 0 205px; background: #fff; border: 1px solid var(--cb-border); border-radius: 3px; padding: 0.75rem;
  font-size: 0.8rem;
}
.addr-sidebar__title { margin-bottom: 0.5rem; font-weight: bold; }
.addr-sidebar__row { display: flex; flex-wrap: nowrap; gap: 0.05rem; margin-bottom: 0.15rem; }
.addr-sidebar a { display: inline-block; padding: 0.1rem 0.05rem; white-space: nowrap; }
.addr-sidebar a.is-active { color: var(--cb-red); font-weight: bold; }
.addr-sidebar__abc { margin-top: 0.4rem; }
.addr-main { flex: 1; min-width: 0; }
.addr-table th, .addr-table td { font-size: 0.85rem; }

.addr-detail-table { width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; font-size: 0.88rem; }
.addr-detail-table th {
  width: 140px; text-align: left; padding: 0.55rem 0.75rem; background: var(--cb-blue-light);
  color: var(--cb-blue-dark); border: 1px solid var(--cb-blue-border);
}
.addr-detail-table td { padding: 0.55rem 0.75rem; border: 1px solid var(--cb-border); }
.addr-contacts-section { margin-top: 1rem; }

@media (max-width: 700px) {
  .addr-layout { flex-direction: column; }
  .addr-sidebar { flex: none; width: 100%; }
}

/* ==========================================================
   スマートフォン対応（幅640px以下）
   ========================================================== */
@media (max-width: 640px) {
  html, body { overflow-x: hidden; }

  /* トップバー: 検索窓を隠し、ユーザー名を隠してアイコンだけにする */
  .cb-topbar { padding: 0.5rem 0.6rem; gap: 0.4rem; }
  .cb-topbar__left { gap: 0.6rem; min-width: 0; }
  .cb-topbar__logo { font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; }
  .cb-search-form { display: none; }
  .cb-topbar__right { gap: 0.4rem; }
  .cb-topbar__icon-link { width: 30px; height: 30px; font-size: 0.95rem; }
  .cb-topbar__user { padding: 0; background: none; }
  .cb-topbar__user span:last-child { display: none; }
  .cb-topbar__user-icon { width: 26px; height: 26px; }

  .cb-banner { height: 32px; }

  /* アプリアイコングリッド: タイルを小さくして1行に収まる数を増やす */
  .cb-app-grid { padding: 0.4rem 0.5rem; gap: 0.15rem; justify-content: space-between; }
  .cb-app-tile { width: 22%; font-size: 0.62rem; padding: 0.4rem 0.1rem; }
  .cb-app-icon { width: 34px; height: 34px; font-size: 1.1rem; border-radius: 9px; }

  .cb-page-title { padding: 0.5rem 0.9rem; font-size: 0.88rem; }
  .cb-main { padding: 0.85rem 0.75rem; }
  .cb-footer { padding: 0.75rem; }

  /* ログイン画面 */
  .login-box { width: 90vw; max-width: 320px; padding: 1.75rem 1.5rem; }

  /* パネル・フォーム共通 */
  .panel { padding: 0.9rem; }
  .panel-header { margin: -0.9rem -0.9rem 0.9rem; padding: 0.65rem 0.9rem; }
  .stacked-form { max-width: 100%; }
  .form-actions { flex-wrap: wrap; }

  /* 予定登録フォーム（Cybozu風）: ラベルを上、入力欄を下に積む */
  .cb-form { padding: 0.9rem; }
  .cb-form-row { flex-direction: column; align-items: stretch; gap: 0.3rem; }
  .cb-form-row__label { flex: none; padding-top: 0; }
  .cb-form-row--top .cb-form-row__label { padding-top: 0; }
  .cb-form-row__content { width: 100%; }
  .cb-form-row__content textarea { max-width: 100%; }

  /* デュアルリストボックス: 縦並びにし、横幅いっぱいに広げる */
  .dual-listbox { flex-direction: column; align-items: stretch; }
  .dual-listbox__selected .dual-listbox__list,
  .dual-listbox__candidates .dual-listbox__list,
  .dual-listbox__search,
  .dual-listbox__group-filter { width: 100%; }
  .dual-listbox__buttons { flex-direction: row; justify-content: center; padding-top: 0; }

  /* 各種横に長いテーブルは横スクロールできるようにする */
  .admin-table, .addr-table, .addr-detail-table, .facility-table,
  .timecard-table, .roster-table, .todo-table, .phone-memo-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  .addr-detail-table th { width: auto; white-space: nowrap; }

  /* トップページのタイムカードウィジェット: 4列の狭い表なので、はみ出させず幅に収める */
  .portal-timecard-table { table-layout: fixed; }
  .portal-timecard-table th { font-size: 0.68rem; padding: 0.15rem 0; }
  .portal-timecard-table .timecard-punch-btn { padding: 0.3rem 0.3rem; font-size: 0.72rem; width: 100%; }
  .portal-timecard__time { font-size: 0.75rem; }

  /* カレンダー */
  .calendar-toolbar { gap: 0.5rem; }
  .calendar-scope { flex-wrap: wrap; gap: 0.5rem; padding: 0.5rem 0.75rem; }
  #calendar { padding: 0.5rem; }
  .fc .fc-daygrid-day-frame { min-height: 60px; }
  .fc-toolbar { flex-direction: column; gap: 0.5rem; }

  /* ツールバー類: 折り返しと余白調整 */
  .facility-toolbar, .timecard-toolbar, .addr-toolbar { flex-wrap: wrap; gap: 0.6rem; }
  .addr-search-form input { width: 100%; }
  .facility-view-tabs { flex-wrap: wrap; }

  /* ボタン類はタップしやすいように少し大きく */
  button, .btn-primary, .btn-secondary, .btn-cancel, .btn-danger {
    padding: 0.55rem 1rem;
  }
}
