:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --line: #d6dde2;
  --text: #182026;
  --muted: #60717d;
  --accent: #126d8f;
  --accent-dark: #0d526c;
  --danger: #b33a3a;
  --warn: #8a6400;
  --ok: #237348;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  min-height: 60px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.topbar-title {
  min-width: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.25rem;
  font-weight: 650;
}

h2 {
  font-size: 1rem;
  font-weight: 650;
}

.topbar p,
.muted {
  color: var(--muted);
  font-size: 0.86rem;
}

/* 通信状態。広い画面ではタイトル＋メッセージ入りのボックス、狭い画面（900px以下）
   では文字を隠して色ドットだけに畳む。詳細はtitle/aria-labelで補う（app.js）。 */
.connection-statuses {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.connection-status {
  min-height: 40px;
  max-width: 280px;
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  background: #f7fafb;
  color: var(--muted);
  font-size: 0.8rem;
  cursor: default;
}

.connection-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--muted);
}

.connection-status strong,
.connection-status div span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-status strong {
  color: var(--text);
  font-size: 0.84rem;
}

.connection-status.ok {
  color: var(--ok);
  border-color: #a7d2bb;
  background: #eef8f2;
}

.connection-status.ok .connection-status-dot {
  background: var(--ok);
}

.connection-status.warning,
.connection-status.checking {
  color: var(--warn);
  border-color: #dfcb88;
  background: #fff8df;
}

.connection-status.warning .connection-status-dot,
.connection-status.checking .connection-status-dot {
  background: var(--warn);
}

.connection-status.error {
  color: var(--danger);
  border-color: #e1adad;
  background: #fff0f0;
}

.connection-status.error .connection-status-dot {
  background: var(--danger);
}

@keyframes status-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

/* ヘッダーのハンバーガーメニュー。上部の操作ボタンとログブック操作を集約する。 */
.menu {
  position: relative;
  flex-shrink: 0;
}

.menu-button {
  min-width: 42px;
  min-height: 40px;
  padding: 6px 10px;
  font-size: 1.15rem;
  line-height: 1;
}

.menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  width: min(280px, calc(100vw - 24px));
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgb(15 23 42 / 18%);
}

.menu-panel[hidden] {
  display: none;
}

.menu-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.menu-section + .menu-section {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.menu-section button {
  width: 100%;
}

.menu-section-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.menu-row {
  display: flex;
  gap: 8px;
}

.menu-row button {
  flex: 1;
}

.menu-panel select {
  width: 100%;
  min-height: 38px;
  border: 1px solid #c4cdd3;
  border-radius: 6px;
  padding: 6px 9px;
  background: #fff;
  color: var(--text);
  /* 16px未満だとiOSがフォーカス時に自動ズームするため1remにする。 */
  font-size: 1rem;
}

.menu-account .session-email {
  margin: 0;
  word-break: break-all;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.75fr);
  gap: 16px;
  padding: 16px;
}

.list-pane,
.editor-pane {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.section-head {
  min-height: 54px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.section-head input[type="search"] {
  width: min(420px, 52vw);
}

/* QSO入力の保存・クリアはフォーム末尾ではなく見出し右上に置く。 */
.editor-head-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* 保存フィードバックは見出し直下の1行に出す。空のときは場所を取らない。 */
.editor-save-status {
  margin: 0;
  padding: 8px 12px 0;
}

.editor-save-status:empty {
  display: none;
}

.operation-result {
  margin: 10px 12px 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--muted);
  background: #f7fafb;
  font-size: 0.84rem;
}

.operation-result strong {
  display: block;
  margin-bottom: 5px;
  color: var(--text);
}

.operation-result ul {
  margin: 0;
  padding-left: 18px;
}

.operation-result li + li {
  margin-top: 3px;
}

.merge-candidate {
  margin-top: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  color: var(--text);
}

.merge-candidate span {
  overflow-wrap: anywhere;
}

.operation-result.success {
  color: var(--ok);
  border-color: #a7d2bb;
  background: #eef8f2;
}

.operation-result.warning,
.operation-result.notice {
  color: var(--warn);
  border-color: #dfcb88;
  background: #fff8df;
}

.operation-result.error {
  color: var(--danger);
  border-color: #e1adad;
  background: #fff0f0;
}

.udp-alert-banner {
  margin: 10px 12px 0;
  border: 1px solid #dfcb88;
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--warn);
  background: #fff8df;
  font-size: 0.84rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.udp-alert-banner[hidden] {
  display: none;
}

.udp-alert-banner button {
  flex-shrink: 0;
}

/* 未反映の保留QSOの案内＋まとめて反映。エラーではなく行動喚起なので青系。 */
.held-banner {
  margin: 10px 12px 0;
  border: 1px solid #a9cbe6;
  border-radius: 6px;
  padding: 9px 10px;
  color: #245c8a;
  background: #eef5fb;
  font-size: 0.84rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.held-banner[hidden] {
  display: none;
}

.held-banner button {
  flex-shrink: 0;
}

/* 編集モードの目印。新規入力と取り違えないよう入力欄の上に帯を出す。 */
.edit-mode-banner {
  margin: 0 12px;
  padding: 8px 10px;
  border: 1px solid #a9cbe6;
  border-radius: 6px;
  color: #245c8a;
  background: #eef5fb;
  font-size: 0.84rem;
  font-weight: 600;
}

.edit-mode-banner[hidden] {
  display: none;
}

.experimental-banner {
  margin: 0;
  padding: 9px 20px;
  color: var(--warn);
  background: #fff8df;
  border-bottom: 1px solid #dfcb88;
  font-size: 0.86rem;
}

.experimental-banner[hidden] {
  display: none;
}

.pairing-target {
  color: var(--accent-dark);
  font-size: 0.86rem;
  font-weight: 600;
}

.pairing-target:empty {
  display: none;
}

input {
  width: 100%;
  min-height: 36px;
  border: 1px solid #c4cdd3;
  border-radius: 6px;
  padding: 7px 9px;
  background: #fff;
  /* iOS WebKitは16px未満の入力欄でフォーカス時に自動ズームし戻らない。
     ラベルの0.84remを継承させず16px(1rem)を明示して防ぐ（PWAと同じ対策）。 */
  font-size: 1rem;
}

input:focus {
  border-color: var(--accent);
  outline: 2px solid color-mix(in srgb, var(--accent) 22%, transparent);
}

input.hamlog-filled,
select.hamlog-filled {
  border-color: #6da8bb;
  background: #edf8fb;
}

input.hamlog-filled:focus,
select.hamlog-filled:focus {
  border-color: #247d99;
  outline-color: color-mix(in srgb, #247d99 28%, transparent);
}

input.frequency-out-of-band {
  border-color: var(--danger);
  background: #fff0f0;
}

input.frequency-out-of-band:focus {
  border-color: var(--danger);
  outline-color: color-mix(in srgb, var(--danger) 26%, transparent);
}

.field-warning {
  display: none;
  color: var(--warn);
  font-size: 0.78rem;
  line-height: 1.35;
}

.field-warning.visible {
  display: block;
}

button {
  min-height: 36px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 7px 12px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}

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

button.secondary {
  color: var(--accent);
  background: #fff;
}

button.danger-outline {
  color: var(--danger);
  border-color: #dca0a0;
  background: #fff;
}

button.row-action {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 0.78rem;
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 160px);
}

/* QSO一覧は1件1カードの縦積み。当日確認が主目的なので時刻・Call・Freq・Mode・
   Name・QTH・ステータスを主役に、hQSL・レコード番号・操作は従属的に置く。
   1件が複数行になってよい。 */
.qso-list {
  display: flex;
  flex-direction: column;
}

.qso-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid #edf1f3;
}

.qso-card:hover {
  background: #f9fbfc;
}

.qso-card-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.qso-card-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  min-width: 0;
}

.qso-when {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  white-space: nowrap;
}

/* 時刻の基準（JST/UTC）を小さなピルで併記し、UTC/JSTの取り違えを防ぐ。 */
.qso-tz {
  display: inline-block;
  padding: 0 0.35em;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  font-size: 0.72rem;
  line-height: 1.5;
  letter-spacing: 0.04em;
  vertical-align: 0.06em;
}

.qso-call {
  font-weight: 650;
  font-size: 1.02rem;
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
}

/* ステータスはヘッダ行の右端へ寄せる。 */
.qso-card-head .status {
  margin-left: auto;
}

.qso-card-rig {
  font-size: 0.9rem;
}

.qso-freq {
  font-variant-numeric: tabular-nums;
}

/* Modeは優先項目なので淡いピルにして周波数と見分けやすくする。 */
.qso-mode {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f6f8f9;
  font-size: 0.8rem;
}

.qso-card-who {
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.qso-card-actions {
  flex-shrink: 0;
  align-items: flex-start;
  justify-content: flex-end;
}

/* 使用頻度の低い操作を畳む「⋯」。ネイティブ<details>。一覧は overflow:auto の
   スクロール枠内なので、絶対配置だと下端で切れる。インラインで下へ開く。 */
.qso-more-summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  min-width: 32px;
  padding: 4px 8px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: #fff;
  color: var(--accent);
  font-size: 0.95rem;
  line-height: 1;
}

.qso-more-summary::-webkit-details-marker {
  display: none;
}

.qso-more[open] > .qso-more-summary {
  background: #eef3f5;
}

.qso-more-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.qso-recno {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.qso-empty {
  padding: 16px 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 9px 10px;
  border-bottom: 1px solid #edf1f3;
  text-align: left;
  vertical-align: top;
  font-size: 0.9rem;
}

th {
  position: sticky;
  top: 0;
  background: #eef3f5;
  z-index: 1;
  color: #30434f;
  font-weight: 650;
}

td {
  overflow-wrap: anywhere;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

tr:hover td {
  background: #f9fbfc;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #f6f8f9;
}

.status.synced {
  color: var(--ok);
  border-color: #a7d2bb;
  background: #eef8f2;
}

.status.pending,
.status.leased,
.status.unknown,
.status.message-sent {
  color: var(--warn);
  border-color: #dfcb88;
  background: #fff8df;
}

/* 保留（未反映）。エラーでも警告でもなく、まだ送っていない下書き状態なので
   中立のグレーにして pending(黄) や synced(緑) と一目で区別する。 */
.status.held {
  color: #3a4a57;
  border-color: #c4cdd3;
  background: #eef1f3;
}

.status.failed {
  color: var(--danger);
  border-color: #e1adad;
  background: #fff0f0;
}

/* 書き戻し保留（対象HDB未オープン等）。失敗ではなく自動再試行を待つ状態なので、
   danger(赤)ではなく info(青)系にして「エラーではない」ことを色で示す（§9.1）。 */
.status.waiting-for-database {
  color: #245c8a;
  border-color: #a9cbe6;
  background: #eef5fb;
}

/* ADIF自動書き戻しの重複確認待ち。人間の確認（近似候補マージ or HAMLOGへ登録）
   が必要なことが分かるよう、warning系より一段強い配色にする。 */
.status.merge-review {
  color: #8a4b00;
  border-color: #e8bd7d;
  background: #fff3e0;
}

.qsl-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.qsl-badge {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f6f8f9;
  color: var(--muted);
  font-size: 0.76rem;
  white-space: nowrap;
}

.qsl-badge.hqsl.eligible {
  color: var(--ok);
  border-color: #a7d2bb;
  background: #eef8f2;
}

.qsl-badge.hqsl.candidate,
.qsl-badge.hqsl.unknown {
  color: var(--warn);
  border-color: #dfcb88;
  background: #fff8df;
}

.qsl-badge.hqsl.not-registered {
  color: var(--danger);
  border-color: #e1adad;
  background: #fff0f0;
}

/* Callの照会状態は項目名の右に小さく出す（照会中・結果・失敗とも）。
   長いメッセージは省略表示にし、全文はtitleツールチップで補う（app.js）。 */
.lookup-status {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lookup-status.loading,
.lookup-status.pending,
.lookup-status.leased {
  color: var(--warn);
}

.lookup-status.ready {
  color: var(--ok);
}

.lookup-status.failed {
  color: var(--danger);
}

/* QSO入力フォーム。各フィールドは必要最小限の幅（f-*クラス）を持ち、
   1行に収まるだけ並べて余った分は折り返す。モバイル専用ではなく全幅共通。 */
form {
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: flex-start;
}

label {
  display: grid;
  gap: 4px;
  color: #374b57;
  font-size: 0.84rem;
}

.call-label-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.f-call {
  flex: 1 1 160px;
  min-width: 0;
}

.f-date {
  flex: 0 1 140px;
}

/* フォーム内のselectはinputと同じ見た目に揃える。font-sizeはiOS自動ズーム防止。 */
form select {
  width: 100%;
  min-height: 36px;
  border: 1px solid #c4cdd3;
  border-radius: 6px;
  padding: 6px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
}

/* 時刻入力＋時計停止ボタン。ボタンをlabelの外に置くのは、label内に入れると
   labelの関連付け先がinputでなくbuttonになってしまうため。
   幅は秒表示（HH:MM:SS）が収まるサイズ。 */
.f-time {
  flex: 0 1 190px;
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.f-time label {
  flex: 1;
  min-width: 0;
}

.f-time button {
  min-width: 38px;
  padding: 7px 8px;
}

.f-freq {
  flex: 0 1 110px;
}

.f-mode {
  flex: 0 1 90px;
}

.f-rst {
  flex: 0 0 60px;
}

/* QSLは「O: ONEWAY」等のラベルが閉じた状態でも読める幅を確保する。 */
.f-qsl {
  flex: 0 1 110px;
}

.f-code {
  flex: 0 1 90px;
}

.f-grid {
  flex: 0 1 100px;
}

.f-half {
  flex: 1 1 45%;
  min-width: 150px;
}

form .actions {
  width: 100%;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check input {
  width: 18px;
  min-height: 18px;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

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

  /* 1カラム時はDOM順（一覧→入力）のままだと、一覧の全行をスクロールしないと
     入力フォームに届かない。運用の主目的は入力なので、入力フォームを先頭に出す。 */
  .editor-pane {
    order: -1;
  }

  /* 入力フォームの下に続く一覧は、画面内スクロールに切り替えて全長を抑える。 */
  .table-wrap {
    max-height: 60vh;
  }

  /* 通信状態は文字を隠し、状態色で塗った14pxのドットだけにする。
     内容はJSがフルで描画しているので、広い画面に戻せばそのまま復元される。 */
  .connection-status {
    width: 14px;
    height: 14px;
    min-height: 14px;
    max-width: none;
    display: block;
    padding: 0;
    border-radius: 50%;
    overflow: hidden;
    background: var(--muted);
  }

  .connection-status > div,
  .connection-status .connection-status-dot {
    display: none;
  }

  .connection-status.ok {
    background: var(--ok);
    border-color: #6fae8c;
  }

  .connection-status.warning,
  .connection-status.checking {
    background: var(--warn);
    border-color: #c7a748;
  }

  .connection-status.checking {
    animation: status-pulse 1.4s ease-in-out infinite;
  }

  .connection-status.error {
    background: var(--danger);
    border-color: #c56d6d;
  }
}

@media (max-width: 560px) {
  /* ヘッダーはタイトル＋状態ドット＋メニューだけになり、狭幕でも1行に収まる。
     縦積みにはせず、はみ出しがちなsummaryだけ省略表示にする。 */
  #summary {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* 一覧側は検索欄を全幅にするため縦積みにする。 */
  .list-pane .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .section-head input[type="search"] {
    width: 100%;
  }

  /* 入力側はタイトルと保存/クリアを狭幕でも横1行（右上）に保つ。 */
  .editor-pane .section-head {
    flex-direction: row;
    align-items: center;
  }

  /* 狭幕でもカードは横並び(row)のまま。操作(⋯/ボタン)とレコード番号は本文の
     下に全幅で回さず、右側の余白へ縦積みで置いて占有スペースを増やさない。 */
  .qso-card-actions {
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-start;
  }
}

.pairing-dialog {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgb(15 23 42 / 25%);
  max-width: 460px;
  padding: 20px 24px;
}

.pairing-dialog::backdrop {
  background: rgb(15 23 42 / 45%);
}

.pairing-dialog h2 {
  margin-top: 0;
}

.pairing-code {
  background: #0f172a;
  border-radius: 8px;
  color: #f8fafc;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 1.25rem;
  letter-spacing: 0.06em;
  margin: 12px 0;
  padding: 14px 16px;
  text-align: center;
  user-select: all;
  word-break: break-all;
}

.pairing-steps {
  margin: 12px 0;
  padding-left: 20px;
}

.pairing-steps li {
  margin-bottom: 6px;
}

.pairing-dialog .actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

.conflict-dialog {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgb(15 23 42 / 25%);
  max-width: 720px;
  padding: 20px 24px;
}

.conflict-dialog::backdrop {
  background: rgb(15 23 42 / 45%);
}

.conflict-dialog h2 {
  margin-top: 0;
}

.conflict-table-wrap {
  max-height: 52vh;
  overflow: auto;
}

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

.conflict-table th,
.conflict-table td {
  border: 0.5px solid #e2e8f0;
  padding: 4px 8px;
  text-align: left;
  vertical-align: top;
  word-break: break-word;
}

.conflict-table thead th {
  background: #f1f5f9;
  position: sticky;
  top: 0;
}

.conflict-field {
  font-weight: 500;
  white-space: nowrap;
}

.conflict-table tr.conflict-diff td {
  background: #fef3c7;
}

/* 再照合比較ダイアログ: 行の薄い強調に加え、クラウド側と実際に異なる
   候補セルだけを濃く強調して、どの欄が違うか一目で分かるようにする。 */
.conflict-table td.reconcile-diff-cell {
  background: #fde68a;
  font-weight: 600;
}

.reconcile-merge-note {
  margin: 6px 0 0;
  font-size: 0.8rem;
  max-width: 240px;
}

.settings-section-title {
  font-size: 0.95rem;
  font-weight: 650;
  margin: 0 0 6px;
}

#settingsDatabases select,
#settingsDatabases input[type="checkbox"] {
  cursor: pointer;
}

/* マージ方式のselectはネイティブ表示幅が最長の選択肢に合わせて広がり、
   ダイアログ幅（.conflict-dialogのmax-width: 720px）を超えて隣の保存ボタンを
   押し出してしまう。閉じた状態の表示幅を抑え、はみ出す分は省略表示にする。
   フルテキストはtitle属性のツールチップで確認できる。 */
#settingsDatabases select {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* HDBのlocalDatabaseKeyはハッシュ由来の長い連続文字列で、空白を含まないため
   通常のword-breakでは折り返せない。break-allで強制的に折り返し、列幅も
   抑えて他の列（件数・最終確認・設定）と重ならないようにする。 */
.settings-db-key {
  font-weight: 500;
  word-break: break-all;
  max-width: 160px;
}

/* 一覧見出しの「？」ヘルプ。操作ボタンの使い分けダイアログを開く。 */
.help-button {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 650;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
}

.help-button:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--panel);
}

.conflict-radio {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-right: 8px;
}

.conflict-dialog .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

.login-gate {
  align-items: center;
  background: #f8fafc;
  display: flex;
  inset: 0;
  justify-content: center;
  min-height: 100vh;
  position: fixed;
}

/* [hidden]の詳細度は.login-gate単体と同点のためCSS適用順で負ける。
   .login-gate[hidden]で詳細度を上げてdisplay:noneを確実に勝たせる。 */
.login-gate[hidden] {
  display: none;
}

.login-gate-card {
  background: #fff;
  border: 0.5px solid #cbd5e1;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgb(15 23 42 / 15%);
  max-width: 360px;
  padding: 32px;
  text-align: center;
}

.login-gate-card h1 {
  margin-top: 0;
}

.login-button {
  background: #1d4ed8;
  border-radius: 8px;
  color: #fff;
  display: inline-block;
  font-weight: 500;
  margin: 16px 0;
  padding: 10px 20px;
  text-decoration: none;
}

.login-button:hover {
  background: #1e40af;
}

.session-email {
  align-self: center;
  color: #475569;
  font-size: 0.85rem;
  margin-right: 8px;
}
