/* 議事録 閲覧サイト
   色は変数で定義し、ライト／ダークの両方で読めるようにする。落ち着いた業務ツールの配色（藍色を基調）。 */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --border: #d8dde4;
  --text: #1d2430;
  --text-muted: #5b6573;
  --accent: #24527a;
  --accent-hover: #1b4061;
  --accent-soft: #e3ecf5;
  --accent-text: #ffffff;
  --own: #e3ecf5;
  --other: #ffffff;
  --mark: #ffe58a;
  --ok: #1e7a4c;
  --ok-soft: #e1f3e9;
  --warn: #9a6200;
  --warn-soft: #fff3d6;
  --danger: #b3261e;
  --danger-soft: #fbe5e3;
  --info-soft: #e7eefc;
  --shadow: 0 1px 2px rgba(20, 30, 45, .06), 0 2px 8px rgba(20, 30, 45, .06);
  --radius: 8px;
  --font: "Segoe UI", "Yu Gothic UI", "Hiragino Sans", "Noto Sans JP", "Meiryo", sans-serif;
  --mono: "Consolas", "SFMono-Regular", "Menlo", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181e;
    --surface: #1c2129;
    --surface-2: #242b35;
    --border: #343d4a;
    --text: #e6e9ee;
    --text-muted: #9aa4b2;
    --accent: #7fb0dc;
    --accent-hover: #a2c6e7;
    --accent-soft: #23364a;
    --accent-text: #0f1a26;
    --own: #23364a;
    --other: #242b35;
    --mark: #6b5a12;
    --ok: #6fcf9d;
    --ok-soft: #173326;
    --warn: #f0b955;
    --warn-soft: #3a2e14;
    --danger: #f2948d;
    --danger-soft: #3d1d1b;
    --info-soft: #1e2b44;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { line-height: 1.3; margin: 0; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .6em; }
mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }
[hidden] { display: none !important; }
.boot { padding: 2rem; color: var(--text-muted); }
.muted { color: var(--text-muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--mono); }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- 部品 ---- */
button, .button {
  font: inherit;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 6px;
  padding: .4rem .85rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-height: 2.2rem;
}
button:hover:not(:disabled), .button:hover { background: var(--surface-2); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button:disabled { opacity: .55; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
button.danger { color: var(--danger); border-color: var(--danger); }
button.danger:hover:not(:disabled) { background: var(--danger-soft); }
button.link { border: none; background: none; color: var(--accent); padding: .2rem .3rem; min-height: auto; }
button.link:hover:not(:disabled) { background: none; text-decoration: underline; }
button.small, .button.small { padding: .2rem .6rem; min-height: 1.8rem; font-size: .85rem; }

input[type=text], input[type=password], input[type=search], input[type=date], input[type=month], select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .4rem .6rem;
  min-height: 2.2rem;
  max-width: 100%;
}
textarea { width: 100%; resize: vertical; line-height: 1.6; }
label.field { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; }
label.field > span { color: var(--text-muted); }
label.check { display: inline-flex; align-items: center; gap: .35rem; cursor: pointer; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem .8rem; margin: 0; }
legend { padding: 0 .3rem; color: var(--text-muted); font-size: .9rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.badge {
  display: inline-block;
  font-size: .75rem;
  line-height: 1.5;
  padding: 0 .5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  white-space: nowrap;
}
.badge.customer { border-color: var(--accent); color: var(--accent); }
.badge.internal { border-color: var(--ok); color: var(--ok); }
.badge.status-done { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.badge.status-processing, .badge.status-recording { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.badge.status-failed { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.notice { border-radius: var(--radius); padding: .6rem .85rem; margin: 0 0 .75rem; background: var(--info-soft); }
.notice.warn { background: var(--warn-soft); }
.notice.error { background: var(--danger-soft); color: var(--danger); }
.notice.ok { background: var(--ok-soft); }
.empty { padding: 2rem 1rem; text-align: center; color: var(--text-muted); }
.spinner { display: inline-block; width: 1em; height: 1em; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -.15em; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

/* ---- 全体の枠 ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem 1rem;
  flex-wrap: wrap;
}
.brand { font-weight: 700; color: var(--text); text-decoration: none; display: flex; align-items: center; gap: .4rem; }
.brand img { width: 22px; height: 22px; }
.nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.nav a { padding: .3rem .6rem; border-radius: 6px; text-decoration: none; color: var(--text-muted); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.topbar .search { display: flex; gap: .35rem; flex: 1 1 14rem; max-width: 26rem; }
.topbar .search input { flex: 1; min-width: 0; }
.userbox { display: flex; align-items: center; gap: .5rem; margin-left: auto; font-size: .9rem; }
main { max-width: 1400px; margin: 0 auto; padding: 1rem; }
.page-head { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .9rem; }

/* ---- ログイン ---- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login { width: 100%; max-width: 380px; padding: 1.5rem; }
.login h1 { margin-bottom: 1rem; display: flex; align-items: center; gap: .5rem; }
.login h1 img { width: 28px; height: 28px; }
.login button.primary { width: 100%; justify-content: center; }
.rules { font-size: .85rem; color: var(--text-muted); margin: 0; padding-left: 1.2rem; }

/* ---- 一覧 ---- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: .75rem; flex-wrap: wrap; }
.tabs button { border: none; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--text-muted); padding: .4rem .75rem; }
.tabs button[aria-selected=true] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: .75rem; }
.filters label.field { min-width: 8rem; }
.meeting-list { display: flex; flex-direction: column; gap: .5rem; }
.meeting-item { display: block; padding: .75rem 1rem; color: inherit; text-decoration: none; }
.meeting-item:hover { border-color: var(--accent); }
.meeting-item .title { font-weight: 600; font-size: 1.02rem; overflow-wrap: anywhere; }
.meeting-item .meta { font-size: .85rem; color: var(--text-muted); display: flex; gap: .3rem .8rem; flex-wrap: wrap; margin: .15rem 0 .3rem; }
.meeting-item .excerpt { font-size: .9rem; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.meeting-item .badges { display: flex; gap: .3rem; flex-wrap: wrap; }
.places { margin: .4rem 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: .25rem; }
.places li { font-size: .88rem; background: var(--surface-2); border-radius: 6px; padding: .3rem .6rem; overflow-wrap: anywhere; }
.places .where { color: var(--text-muted); font-size: .78rem; margin-right: .4rem; }
.more { display: flex; justify-content: center; margin: 1rem 0; }

/* ---- 詳細 ---- */
.detail-head { padding: .9rem 1rem; margin-bottom: .75rem; }
.detail-head h1 { overflow-wrap: anywhere; }
.detail-head .meta { color: var(--text-muted); font-size: .88rem; display: flex; gap: .3rem 1rem; flex-wrap: wrap; margin-top: .3rem; }
.detail-cols { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) 300px; gap: .75rem; align-items: start; }
.col { padding: .75rem; min-width: 0; }
.col-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .6rem; }
.col-head h2 { margin-right: auto; }
.mobile-tabs { display: none; }
@media (max-width: 899px) {
  .detail-cols { grid-template-columns: minmax(0, 1fr); }
  .mobile-tabs { display: flex; position: sticky; top: 0; background: var(--bg); z-index: 5; }
  .detail-cols > .col[data-tab]:not(.current) { display: none; }
}
.transcript-scroll { max-height: calc(100vh - 16rem); min-height: 16rem; overflow-y: auto; padding-right: .25rem; }
@media (max-width: 899px) { .transcript-scroll { max-height: none; } }
.bubble-row { display: flex; flex-direction: column; align-items: flex-start; margin: 0 0 .55rem; }
.bubble-row.own { align-items: flex-end; }
.bubble-row .who { font-size: .75rem; color: var(--text-muted); margin: 0 .3rem .1rem; }
.bubble {
  max-width: 88%;
  background: var(--other);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .4rem .7rem;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  display: block;
  overflow-wrap: anywhere;
}
.bubble-row.own .bubble { background: var(--own); border-color: transparent; }
.bubble .jp { display: block; font-size: .86rem; color: var(--text-muted); margin-top: .15rem; }
.bubble .note { display: block; font-size: .85rem; color: var(--warn); }
.bubble.playing { outline: 2px solid var(--accent); outline-offset: 1px; }
.bubble.hit { box-shadow: 0 0 0 2px var(--mark); }
.log-tools { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; margin-bottom: .5rem; }
.log-tools input[type=search] { flex: 1 1 8rem; min-width: 0; }
.player { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .5rem .6rem; margin-top: .6rem; background: var(--surface-2); border-radius: var(--radius); }
.player input[type=range] { flex: 1 1 8rem; min-width: 6rem; accent-color: var(--accent); }
.player .time { font-variant-numeric: tabular-nums; font-size: .85rem; color: var(--text-muted); }
.minutes { overflow-wrap: anywhere; }
.minutes .header-lines { font-size: .85rem; color: var(--text-muted); margin-bottom: .6rem; white-space: pre-line; }
.minutes h3.h-section { font-size: 1.02rem; margin: 1rem 0 .4rem; padding-bottom: .2rem; border-bottom: 1px solid var(--border); }
.minutes h4.h-sub { font-size: .95rem; margin: .7rem 0 .25rem; }
.minutes ul { margin: 0 0 .4rem; padding-left: 1.2rem; }
.minutes li { margin: .1rem 0; }
.minutes p { margin: .2rem 0 .4rem; }
.minutes .note { font-size: .85rem; color: var(--text-muted); white-space: pre-line; }
.info dl { margin: 0; display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: .35rem .5rem; font-size: .9rem; }
.info dt { color: var(--text-muted); }
.info dd { margin: 0; overflow-wrap: anywhere; }
.info section + section { margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--border); }
.downloads { display: flex; flex-direction: column; gap: .35rem; }
.downloads button { justify-content: flex-start; }
.check-list { max-height: 12rem; overflow-y: auto; display: flex; flex-direction: column; gap: .2rem; padding: .3rem; border: 1px solid var(--border); border-radius: 6px; }

/* ---- 表（管理） ---- */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.code-box { font-family: var(--mono); font-size: 2rem; letter-spacing: .25em; padding: .5rem 1rem; background: var(--surface-2); border-radius: var(--radius); display: inline-block; }
.secret { font-family: var(--mono); overflow-wrap: anywhere; background: var(--surface-2); padding: .3rem .5rem; border-radius: 6px; }

/* ---- ダイアログ・お知らせ ---- */
dialog { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 1.1rem; width: min(32rem, calc(100vw - 2rem)); box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }
dialog::backdrop { background: rgba(10, 15, 25, .45); }
dialog h2 { margin-bottom: .75rem; }
dialog .actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; }
.toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 100; max-width: min(24rem, calc(100vw - 2rem)); }
.toast { background: var(--text); color: var(--bg); border-radius: var(--radius); padding: .55rem .9rem; box-shadow: var(--shadow); font-size: .9rem; }
.toast.error { background: var(--danger); color: #fff; }

@media (max-width: 600px) {
  main { padding: .6rem; }
  .topbar { padding: .45rem .6rem; gap: .45rem; }
  .topbar .search { order: 5; flex-basis: 100%; max-width: none; }
  .userbox .name { display: none; }
  .filters label.field { min-width: 0; flex: 1 1 45%; }
  .meeting-item { padding: .65rem .75rem; }
  .info dl { grid-template-columns: 5.5rem minmax(0, 1fr); }
  .bubble { max-width: 96%; }
  .code-box { font-size: 1.6rem; }
}

/* 参加者 */
.ext-row { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: .35rem; align-items: center; }
.ext-row input { min-width: 0; }
ul.plain { list-style: none; margin: 0; padding: 0; }
@media (max-width: 480px) {
  .ext-row { grid-template-columns: 1fr 1fr; padding-bottom: .4rem; border-bottom: 1px dashed var(--border); }
  .ext-row input[data-key="company"], .ext-row button { grid-column: span 2; }
  .ext-row button { justify-self: end; }
}
.ext-rows:not(:empty) { margin-bottom: .4rem; }

/* ---- 録音・取り込み（フェーズ 2） ---- */
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-text); }
button.big { font-size: 1.05rem; padding: .7rem 1.5rem; min-height: 3rem; min-width: 8rem; justify-content: center; }
button.danger.big { background: var(--danger); border-color: var(--danger); color: #fff; }
button.danger.big:hover:not(:disabled) { background: var(--danger); filter: brightness(1.1); }
.rec-card { max-width: 44rem; }
.rec-card ul { margin: .3rem 0 .5rem; padding-left: 1.3rem; }
.rec-head { margin-bottom: .75rem; display: flex; flex-direction: column; gap: .7rem; }
.rec-clock { font-family: var(--mono); font-size: 1.6rem; font-variant-numeric: tabular-nums; min-width: 5.5rem; }
.rec-state { font-weight: 600; }
.rec-dot { width: .8rem; height: .8rem; border-radius: 50%; background: var(--danger); animation: rec-blink 1.2s ease-in-out infinite; }
.rec-dot.paused { background: var(--text-muted); animation: none; }
@keyframes rec-blink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .rec-dot { animation: none; } }
.rec-buttons { gap: .75rem; }
.rec-status { margin: 0; }
.rec-warnings .notice { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.meters { display: flex; flex-direction: column; gap: .35rem; max-width: 30rem; }
.meter-row { display: flex; align-items: center; gap: .6rem; }
.meter-label { font-size: .85rem; color: var(--text-muted); min-width: 7.5rem; }
.rec-head .meter-label { min-width: 2.5rem; }
progress.meter { flex: 1; height: .7rem; min-width: 6rem; appearance: none; -webkit-appearance: none; border: none; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
progress.meter::-webkit-progress-bar { background: var(--surface-2); border-radius: 999px; }
progress.meter::-webkit-progress-value { background: var(--ok); border-radius: 999px; }
progress.meter::-moz-progress-bar { background: var(--ok); border-radius: 999px; }
progress.meter.wide { width: 100%; height: .9rem; }
progress.meter.wide::-webkit-progress-value { background: var(--accent); }
progress.meter.wide::-moz-progress-bar { background: var(--accent); }
.rec-live { display: flex; flex-direction: column; }
.live-scroll { height: min(52vh, 34rem); overflow-y: auto; padding: .4rem .2rem; }
.bubble-row.pending .bubble { opacity: .55; border-style: dashed; }
.live-scroll .bubble { cursor: default; text-align: left; }
.live-note { text-align: center; margin: .6rem 0; }
input[type=file] { font: inherit; color: var(--text); max-width: 100%; }

@media (max-width: 600px) {
  button.big { flex: 1; min-width: 0; }
  .live-scroll { height: 46vh; }
  .meter-label { min-width: 5.5rem; }
}
.rec-card, .rec-head, .rec-live { padding: 1rem 1.1rem; }

/* ---- 押すまで消えないお知らせ（議事録ができあがったとき） ---- */
.toast.sticky { display: flex; align-items: center; gap: .6rem; }
.toast.sticky .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast.sticky a { color: inherit; font-weight: 600; text-decoration: underline; white-space: nowrap; }
.toast-close { background: transparent; border: none; color: inherit; font-size: 1.1rem; line-height: 1; padding: .1rem .3rem; cursor: pointer; min-height: 0; }
