:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f1f3f4;
  --text: #202124;
  --muted: #5f6368;
  --border: #e3e5e8;

  --meet-green: #00AC47;
  --meet-green-strong: #008f3a;
  --google-blue: #4285F4;
  --google-blue-bg: #e8f0fe;
  --google-red: #EA4335;
  --google-red-bg: #fce8e6;
  --google-yellow: #FBBC05;
  --google-yellow-bg: #fef7e0;

  --accent: var(--meet-green);
  --accent-strong: var(--meet-green-strong);
  --danger: var(--google-red);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans",
    "Yu Gothic UI", "Meiryo", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.04);
}

header h1 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

header h1 a {
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

header h1 img {
  width: 24px;
  height: 24px;
}

header nav {
  display: flex;
  gap: 1rem;
  align-items: center;
  font-size: 0.9rem;
}

header nav a {
  color: var(--muted);
  text-decoration: none;
}

header nav a:hover {
  color: var(--accent);
}

main {
  max-width: 980px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 2rem;
}

h2 {
  font-size: 1.1rem;
  margin: 1rem 0 0.5rem;
  font-weight: 600;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  margin-bottom: 0.6rem;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.05);
}

input[type="text"],
input[type="url"] {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
}

input[type="text"]:focus,
input[type="url"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 172, 71, 0.15);
}

button {
  padding: 0.6rem 1.2rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  border-color: var(--accent);
  background: transparent;
  color: var(--accent);
}

.row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.row > input {
  flex: 1;
}

.muted {
  color: var(--muted);
  font-size: 0.85rem;
}

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

.session {
  border-left: 3px solid var(--accent);
  padding: 0.85rem 1rem;
  margin-bottom: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.05);
}

.session-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.session-meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.links a {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.22rem 0.6rem;
  font-size: 0.78rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s;
}

.links a:hover {
  background: var(--surface);
}

.link-transcript {
  background: var(--google-blue-bg) !important;
  border-color: var(--google-blue-bg) !important;
  color: var(--google-blue) !important;
}

.link-transcript:hover {
  border-color: var(--google-blue) !important;
}

.link-recording {
  background: var(--google-red-bg) !important;
  border-color: var(--google-red-bg) !important;
  color: var(--google-red) !important;
}

.link-recording:hover {
  border-color: var(--google-red) !important;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--surface-2);
}

.signin {
  max-width: 380px;
  margin: 6rem auto;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.08);
}

.signin h1 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0 0 0.5rem;
}

.signin h1 img {
  width: 32px;
  height: 32px;
}

.signin button {
  width: 100%;
  font-size: 1rem;
  padding: 0.8rem;
}

.signin-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0 1rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.signin-divider::before,
.signin-divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--border);
}

#kw-form {
  display: flex;
  gap: 0.5rem;
}

#kw-form input {
  flex: 1;
}

#kw-form button {
  width: auto;
  white-space: nowrap;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: var(--surface-2);
  color: var(--muted);
}

.badge-admin {
  background: var(--google-blue-bg);
  color: var(--google-blue);
}

code {
  background: var(--surface-2);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.85em;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
}

td a {
  color: var(--google-blue);
  text-decoration: none;
}

td a:hover {
  text-decoration: underline;
}

td a code {
  color: inherit;
}

/* --- 検索結果: 1開催 = 1行（旧: コード単位で束ねて右パネルに寄せていた） --- */
.hits-head {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 1rem 0 0.25rem;
}
.hits-head h2 {
  margin: 0;
}
.hits-note {
  font-size: 0.8rem;
  margin: 0 0 0.5rem;
}

.sort-seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.sort-btn {
  appearance: none;
  border: 0;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  padding: 0.25rem 0.7rem;
  cursor: pointer;
}
.sort-btn + .sort-btn {
  border-left: 1px solid var(--border);
}
.sort-btn[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
}

.hits {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}
/* 1行目: タイトル（大きめ）＋リンク／2行目: 日付 ／ 録画者 ／ Meetキー */
.hit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.1rem 0.8rem;
  padding: 0.5rem 0.85rem;
}
.hit + .hit {
  border-top: 1px solid var(--border);
}
.hit-title {
  grid-column: 1;
  grid-row: 1;
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.35;
  min-width: 0;
}
.hit-sub {
  grid-column: 1;
  grid-row: 2;
  font-size: 0.75rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.hit .links {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  margin-top: 0;
  gap: 0.3rem;
}

/* 一括DL: チェックはタイトルの頭に置く（グリッドの列は増やさない） */
.hit-title {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
}
.dl-check,
.dl-check-none {
  flex: none;
  width: 1rem;
  height: 1rem;
  margin: 0.15rem 0 0;
}
.bulk-bar {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-left: auto;
  font-size: 0.8rem;
}
.bulk-all {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
}
.bulk-btn {
  appearance: none;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  padding: 0.25rem 0.7rem;
  cursor: pointer;
}
.bulk-btn:disabled {
  background: var(--surface);
  color: var(--muted);
  border-color: var(--border);
  cursor: default;
}

@media (max-width: 640px) {
  .hit {
    grid-template-columns: 1fr;
  }
  .hit .links {
    grid-column: 1;
    grid-row: auto;
    margin-top: 0.25rem;
  }
}

/* Admin catalog (突合状況) page */
main.wide {
  max-width: 1200px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.05);
}

.stat-val {
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

/* 最終同期カードは日時が長いので1行に収める */
.stat-sync .stat-val {
  font-size: 1rem;
  white-space: nowrap;
}

/* クリックできるサマリカード（未解決ファイル → ドリルダウン） */
a.stat-link {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

a.stat-link:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 6px rgba(60, 64, 67, 0.12);
}

a.stat-link .stat-label {
  color: var(--accent);
}

.toolbar {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar input[type="text"] {
  flex: 1;
  min-width: 180px;
}

.toolbar select,
.toolbar input[type="date"] {
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
}

.mon-doubt {
  color: var(--google-red);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: help;
}

.mon-ok {
  color: var(--muted);
  font-size: 0.85rem;
  cursor: help;
}

.stat-doubt .stat-val {
  color: var(--google-red);
}

tr.total-row td {
  font-weight: 600;
  background: var(--surface-2);
  border-bottom: 2px solid var(--border);
}

.toolbar button {
  white-space: nowrap;
}

.cat-title {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

td.nowrap,
th.nowrap {
  white-space: nowrap;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}

.loading-dots::after {
  content: "";
  display: inline-block;
  width: 1.5em;
  text-align: left;
  animation: dots 1.2s steps(4, end) infinite;
}

@keyframes dots {
  0%   { content: ""; }
  25%  { content: "."; }
  50%  { content: ".."; }
  75%  { content: "..."; }
  100% { content: "..."; }
}

/* 区分タブ（録画一覧 SMTG/その他） */
.tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
}
.tab:hover { background: var(--surface-2); }
.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.tab-n {
  font-size: 0.78rem;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
}
.tab.active .tab-n { background: rgba(255, 255, 255, 0.25); }

/* モニタリングレビュー: バッジ追加・行クリック・モーダル */
.badge-ok { background: var(--google-blue-bg); color: var(--google-blue); }
.badge-doubt { background: var(--google-red-bg); color: var(--google-red); font-weight: 600; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--surface-2); }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 4vh 1rem; z-index: 1000; overflow-y: auto;
}
.modal-card {
  background: var(--surface); border-radius: 12px; padding: 1.4rem 1.6rem;
  max-width: 720px; width: 100%; box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  position: relative;
}
.modal-card h3 { margin: 0 1.5rem 0.2rem 0; }
.modal-x {
  position: absolute; top: 0.7rem; right: 0.9rem; border: none; background: none;
  font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--muted);
}
.modal-x:hover { color: var(--text); }
.mon-section { margin: 0.8rem 0; }
.mon-result {
  white-space: pre-wrap; word-break: break-word; background: var(--surface-2);
  border-radius: 8px; padding: 0.8rem; margin: 0.5rem 0; max-height: 320px; overflow-y: auto;
  font-size: 0.86rem;
}
.mon-summary { margin-top: 0.4rem; font-size: 0.86rem; }
.mon-summary summary { cursor: pointer; color: var(--muted); }
.mon-q { display: block; font-weight: 600; margin: 0.7rem 0 0.3rem; }
.mon-q .req { color: #d33; margin-left: 0.15rem; }
.mon-radios { display: flex; gap: 1.2rem; }
.mon-review-form select,
.mon-review-form textarea,
.mon-review-form input[type="text"] { width: 100%; box-sizing: border-box; }
.mon-review-view > div { margin: 0.35rem 0; }

/* モニタリングモーダルの出典リンク */
.mon-links { display: flex; gap: 1rem; flex-wrap: wrap; margin: 0.2rem 0 0.6rem; font-size: 0.92rem; }
.mon-links a { color: var(--google-blue); text-decoration: none; font-weight: 600; }
.mon-links a:hover { text-decoration: underline; }

/* 要望ボード */
.req-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 0.9rem; margin-bottom: 0.8rem; }
.req-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem; font-size: 0.85rem; }
.req-body, .req-resp { width: 100%; box-sizing: border-box; }
.req-resp-wrap { margin-top: 0.5rem; }
.req-actions { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.5rem; }
.req-badge { padding: 0.1rem 0.6rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.badge-todo { background: var(--google-yellow-bg); color: #8a6d00; }
.badge-doing { background: var(--google-blue-bg); color: #1559c4; }
.badge-done { background: #e6f4ea; color: #137333; }

/* モニタリング ヘッダー（右上に要望ボタン） */
.mon-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.mon-header h2 { margin: 0; }
.req-new { margin-bottom: 1rem; }
.req-new textarea { width: 100%; box-sizing: border-box; margin-top: 0.4rem; }
.req-head .req-status { font-size: 0.85rem; }

/* ご意見・ご要望ボタン（目立たせる） */
#open-req {
  background: var(--accent);
  color: #fff;
  border: none;
  font-weight: 700;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0, 172, 71, 0.35);
  white-space: nowrap;
}
#open-req:hover { background: var(--accent-strong); box-shadow: 0 3px 10px rgba(0, 172, 71, 0.45); }

/* 録画チップに添える再生時間。ラベルより一段小さく、控えめに */
.link-meta {
  font-size: 0.68rem;
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}
