/* =====================================================================
   「秘書AI」 スタイル

   方針:
     - スマホ(iPhone)を第一に。320px 幅でも崩れない。
     - タップ領域は 44px 以上。主要操作は画面の下側に置く。
     - 明るく清潔感のある見た目。業務システム風の詰まった表組みにしない。
     - 説明を読まなくても使えるように、文字は大きめ・余白は広めに。
   ===================================================================== */

:root {
  --bg: #f7f8f7;
  --surface: #ffffff;
  --surface-alt: #f1f4f2;
  --border: #e2e7e4;
  --text: #1e2622;
  --text-muted: #64716b;
  --accent: #3f7f6f;
  --accent-soft: #e8f2ef;
  --accent-strong: #2f6255;
  --danger: #b4413c;
  --danger-soft: #fbeceb;
  --warning: #9a6b1f;
  --warning-soft: #fdf3e0;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 40, 33, .06), 0 6px 18px rgba(20, 40, 33, .05);
  --nav-height: 62px;
  --tap: 44px;
  /* 本文の最大幅。スマホ基準の720pxから、画面に応じて広げる。 */
  --page-width: 720px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181a;
    --surface: #1c2224;
    --surface-alt: #232b2d;
    --border: #2f393b;
    --text: #e8eeeb;
    --text-muted: #97a5a0;
    --accent: #6db6a1;
    --accent-soft: #1f3630;
    --accent-strong: #8ecdb9;
    --danger: #e2827c;
    --danger-soft: #33211f;
    --warning: #d9ac63;
    --warning-soft: #2f2718;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN",
    "Yu Gothic", Meiryo, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 8px);
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------- ヘッダー */

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top, 0px);
}

.app-header-inner {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  min-height: var(--tap);
}

.app-brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}

.app-brand-text { font-size: 16px; }

.app-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

/* 幅の狭い端末では、メニューはアイコンだけにする */
@media (max-width: 400px) {
  .header-menu-label { display: none; }
}

/* ------------------------------------------------------------------ 本文 */

.app-main {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 14px 16px 24px;
}

.app-main-plain { padding-top: 40px; }

.page-title {
  font-size: 20px;
  font-weight: 700;
  margin: 4px 0 14px;
}

.page-lead {
  color: var(--text-muted);
  margin: -8px 0 16px;
  font-size: 14px;
}

.section {
  margin: 0 0 18px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 8px;
}

.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: .02em;
  margin: 0;
}

.section-count {
  font-size: 13px;
  color: var(--text-muted);
}

/* 見出し横のリンク（「すべて見る」等）も、指で押せる大きさを確保する。
   文字の見た目は変えず、当たり判定だけ 44px にする。 */
a.section-count {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 4px;
  margin-right: -4px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}

.card + .card { margin-top: 10px; }

.empty {
  color: var(--text-muted);
  font-size: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
}

/* ------------------------------------------------------------ 次の予定 */

.next-event {
  background: linear-gradient(160deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.next-event-label {
  font-size: 12px;
  opacity: .85;
  letter-spacing: .08em;
  margin: 0 0 6px;
}

.next-event-time {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.next-event-title {
  font-size: 17px;
  margin: 2px 0 10px;
  word-break: break-word;
}

.next-event-countdown {
  display: inline-block;
  background: rgba(255, 255, 255, .18);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 14px;
  font-weight: 600;
}

.next-event-meta {
  font-size: 13px;
  opacity: .9;
  margin: 8px 0 0;
}

.next-event.is-empty {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.next-event.is-empty .next-event-label { color: var(--text-muted); opacity: 1; }

/* -------------------------------------------------------- クイック入力 */

.quick-form {
  display: flex;
  gap: 8px;
  margin: 0 0 18px;
}

.quick-input {
  flex: 1;
  min-width: 0;
  min-height: var(--tap);
  padding: 11px 14px;
  font-size: 16px; /* iOS で自動ズームさせないため 16px 以上 */
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

.quick-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.quick-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: -12px 0 18px;
}

/* -------------------------------------------------------------- ボタン */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--surface-alt);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn-block { width: 100%; }
/* 小さいボタンでも、指で押す高さ(44px)は下げない。
   小さくするのは文字と左右の余白だけ。 */
.btn-sm { min-height: var(--tap); padding: 8px 12px; font-size: 14px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* ------------------------------------------------------------ ToDo 行 */

.todo-list { list-style: none; margin: 0; padding: 0; }

.todo-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
}

.todo-item.is-overdue { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.todo-item.is-done { opacity: .6; }

.todo-check {
  flex: none;
  width: var(--tap);
  height: var(--tap);
  margin: -4px 0 0 -6px;
  display: grid;
  place-items: center;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 20px;
}

.todo-check:hover { background: var(--surface-alt); }
.todo-check.is-done { color: var(--accent); }

.todo-body { flex: 1; min-width: 0; }

.todo-title {
  font-size: 16px;
  word-break: break-word;
  display: block;
  color: var(--text);
  text-decoration: none;
  /* 見た目の位置は変えずに、当たり判定の高さを 44px 以上にする
     （上下の padding を、同じ分だけの負の margin で打ち消している） */
  padding: 10px 0;
  margin: -4px 0 -10px;
}

.todo-item.is-done .todo-title { text-decoration: line-through; }

.todo-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-alt);
  font-size: 12px;
  line-height: 1.7;
}

.tag-overdue { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.tag-today { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.tag-prio-high { background: var(--warning-soft); color: var(--warning); font-weight: 600; }
.tag-prio-urgent { background: var(--danger-soft); color: var(--danger); font-weight: 700; }
.tag-muted { color: var(--text-muted); }

.todo-actions { flex: none; display: flex; align-items: center; }

/* -------------------------------------------------------------- 予定行 */

.event-item {
  display: flex;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 8px;
  text-decoration: none;
  color: var(--text);
}

.event-item.is-past { opacity: .55; }
.event-item.is-now { border-color: var(--accent); background: var(--accent-soft); }

.event-time {
  flex: none;
  width: 58px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 15px;
}

.event-time small { display: block; font-weight: 400; color: var(--text-muted); font-size: 12px; }

.event-body { flex: 1; min-width: 0; }
.event-title { font-size: 15px; word-break: break-word; }
.event-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.day-group { margin-bottom: 18px; }
.day-heading {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin: 0 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.day-heading.is-today { color: var(--accent-strong); }

/* -------------------------------------------------------------- フォーム */

.form-field { margin-bottom: 14px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.field-input {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  font-size: 16px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

.field-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

textarea.field-input { min-height: 88px; resize: vertical; }

.form-help { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.form-errors {
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 14px;
}

.form-errors ul { margin: 0; padding-left: 18px; }

.field-error { color: var(--danger); font-size: 13px; margin-top: 4px; }

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
}

.check-row input[type="checkbox"],
.check-row input[type="radio"] { width: 24px; height: 24px; accent-color: var(--accent); }

/* チェックボックス本体は 24px だが、隣のラベルを 44px の当たり判定にして
   「文字のどこを押しても切り替わる」ようにする。 */
.check-row > label {
  display: inline-flex;
  align-items: center;
  flex: 1;
  min-height: var(--tap);
  cursor: pointer;
}

.radio-cards { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; }
.radio-cards label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  min-height: var(--tap);
  cursor: pointer;
}
.radio-cards input { width: 22px; height: 22px; accent-color: var(--accent); }

.form-grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
@media (max-width: 420px) { .form-grid { grid-template-columns: 1fr; } }

/* -------------------------------------------------------------- 下部ナビ */

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--nav-height);
  text-decoration: none;
  color: var(--text-muted);
  font-size: 11px;
  padding: 6px 2px;
}

.nav-item.is-active { color: var(--accent-strong); font-weight: 700; }
.nav-icon { font-size: 20px; line-height: 1; }
.nav-label { line-height: 1.2; }

/* --------------------------------------------------------------- 通知類 */

.flash-area { margin-bottom: 12px; display: grid; gap: 8px; }

.flash {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.flash-error { background: var(--danger-soft); color: var(--danger); }
.flash-warning { background: var(--warning-soft); color: var(--warning); }

.notice {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14px;
  background: var(--warning-soft);
  color: var(--warning);
  margin-bottom: 14px;
}

.notice-info { background: var(--accent-soft); color: var(--accent-strong); }
.notice strong { display: block; margin-bottom: 3px; }

/* --------------------------------------------------------------- 認証画面 */

.auth-card {
  max-width: 380px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 22px;
}

.auth-brand { text-align: center; margin-bottom: 20px; }
.auth-brand-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin: 0 auto 10px;
  border-radius: 16px;
  background: var(--accent);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
}
.auth-brand-name { font-size: 19px; font-weight: 700; margin: 0; }
.auth-brand-tag { font-size: 13px; color: var(--text-muted); margin: 2px 0 0; }

/* --------------------------------------------------------------- 一覧・雑 */

.list-links { list-style: none; margin: 0; padding: 0; }

.list-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: var(--tap);
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  text-decoration: none;
  color: var(--text);
}

.list-link small { color: var(--text-muted); font-size: 12px; }

.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; }
.chip-row::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  padding: 7px 14px;
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  white-space: nowrap;
}

.chip.is-active { background: var(--accent); color: #fff; border-color: var(--accent); }

.brief-box {
  width: 100%;
  min-height: 260px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

.stat-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

/* 2段階認証のQRコード。白地に黒で描かれるので、暗い配色でも白の下敷きを敷く。 */
.qr-box {
  display: inline-block;
  background: #fff;
  padding: 10px;
  border-radius: var(--radius-sm);
  line-height: 0;
}

.qr-box svg {
  width: 200px;
  height: 200px;
  max-width: 100%;
  display: block;
}

@media print {
  .app-header, .bottom-nav, .btn-row, .notice { display: none !important; }
  body { padding-bottom: 0; background: #fff; color: #000; }
  .brief-box { border: 1px solid #000; height: auto; overflow: visible; }
}

.code-block {
  display: block;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  overflow-x: auto;
  word-break: break-all;
}

.table-scroll { overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--surface);
}

table.data th, table.data td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table.data th { color: var(--text-muted); font-size: 12px; font-weight: 600; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.spacer { height: 8px; }

.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-small { font-size: 13px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 14px; }
.mb-2 { margin-bottom: 8px; }

/* =====================================================================
   ホーム画面
   ---------------------------------------------------------------------
   目的: 開いた瞬間に「今日どういう日か」「次に何をするか」
         「危ないものは何か」が分かること。

   HTML の並びはスマホ基準（1カラム）のまま。
   PC では CSS だけで2カラムへ組み替える。
   ===================================================================== */

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------ 挨拶 */

.home-greeting { margin: 2px 0 18px; }

.home-greeting-main {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  letter-spacing: .01em;
}

.home-greeting-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin: 2px 0 0;
}

/* -------------------------------------------------------- 2カラム */

.home-grid { display: block; }
.home-main, .home-side { min-width: 0; }

/* --------------------------------------------------- サマリータイル */

.summary-tiles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

/* 幅が狭いときは2列にして、数字が潰れないようにする */
@media (max-width: 359px) {
  .summary-tiles { grid-template-columns: repeat(2, 1fr); }
}

.summary-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-height: 84px;
  padding: 10px 4px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
}

.summary-tile-icon {
  font-size: 13px;
  line-height: 1;
  opacity: .75;
}

.summary-tile-count {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.summary-tile-label {
  font-size: 12px;
  color: var(--text-muted);
}

/* 色だけで区別しないよう、アイコンと数字も一緒に変える */
.summary-tile.tone-danger {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
  background: var(--danger-soft);
}
.summary-tile.tone-danger .summary-tile-count,
.summary-tile.tone-danger .summary-tile-icon { color: var(--danger); }

.summary-tile.tone-warn {
  border-color: color-mix(in srgb, var(--warning) 45%, var(--border));
  background: var(--warning-soft);
}
.summary-tile.tone-warn .summary-tile-count,
.summary-tile.tone-warn .summary-tile-icon { color: var(--warning); }

.summary-tile.tone-accent .summary-tile-count { color: var(--accent-strong); }

/* 0件のときは静かに見せる（気付けるが主張しない） */
.summary-tile.is-zero { background: var(--surface); }
.summary-tile.is-zero .summary-tile-count { color: var(--text-muted); font-weight: 600; }

/* ---------------------------------------------------- クイック入力 */

.quick-section { margin-bottom: 20px; }

.quick-input-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}

.quick-section .quick-input {
  width: 100%;
  min-height: 52px;
  font-size: 16px;
  padding: 12px 52px 12px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.quick-section .quick-form { margin-bottom: 8px; }

.quick-submit { min-height: 52px; flex: none; }

.quick-mic {
  position: absolute;
  right: 4px;
  /* 指で押せる大きさ（44px）を確保する。入力欄が52pxなので収まる。 */
  width: var(--tap);
  height: var(--tap);
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 17px;
  cursor: pointer;
}

.quick-mic:hover { background: var(--surface-alt); }
.quick-mic.is-listening { background: var(--danger-soft); color: var(--danger); }

.quick-hint { margin: 0 0 4px; }
.quick-hint-detail { display: block; opacity: .85; }

.quick-voice-status {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
  min-height: 1.2em;
}

/* ------------------------------------------------------ 今やること */

.focus-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.focus-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.focus-rank {
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.focus-check { flex: none; margin: 0; }

.focus-body {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.focus-title {
  font-size: 16px;
  color: var(--text);
  text-decoration: none;
  word-break: break-word;
  /* 見た目は変えず、当たり判定だけ 44px にする */
  padding: 10px 0;
  margin: -10px 0;
}

.focus-reason {
  font-size: 12px;
  color: var(--text-muted);
}

.focus-reason.tone-danger { color: var(--danger); font-weight: 600; }
.focus-reason.tone-warn { color: var(--warning); font-weight: 600; }
.focus-reason.tone-accent { color: var(--accent-strong); font-weight: 600; }

/* ---------------------------------------------------------- 空状態 */

.empty-state {
  padding: 22px 18px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.empty-state-compact { padding: 16px 14px; }

.empty-state-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}

.empty-state-body {
  font-size: 13px;
  color: var(--text-muted);
  margin: 4px 0 0;
}

/* -------------------------------------------------- 次の予定（強化） */

.next-event-end { font-size: 16px; font-weight: 600; opacity: .85; }

.next-event.is-now {
  background: linear-gradient(160deg, var(--danger) 0%, color-mix(in srgb, var(--danger) 70%, #000) 100%);
}

.next-event-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.next-event-tags .tag {
  background: rgba(255, 255, 255, .2);
  color: #fff;
  border: 0;
}

.next-event-action { margin-top: 12px; }

.btn-on-accent {
  background: #fff;
  color: var(--accent-strong);
  font-weight: 700;
}
.btn-on-accent:hover { background: rgba(255, 255, 255, .88); }

.next-event-empty-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}

.next-event-empty-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  font-size: 14px;
  color: var(--accent-strong);
  text-decoration: none;
}

.next-event.is-empty { padding: 14px 16px; }

/* ------------------------------------------------------ 準備の確認 */

.prepare-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--warning-soft);
  border: 1px solid color-mix(in srgb, var(--warning) 35%, var(--border));
  border-radius: var(--radius);
}

.prepare-item + .prepare-item { margin-top: 8px; }

.prepare-body { flex: 1; min-width: 0; }

.prepare-time {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-right: 8px;
}

.prepare-title { word-break: break-word; }

.plain-list { list-style: none; margin: 0; padding: 0; }

.section-note {
  font-size: 12px;
  color: var(--text-muted);
  margin: 8px 0 0;
}

/* ------------------------------------------------------------ タグ */

.tag-important {
  background: var(--danger-soft);
  color: var(--danger);
}

.tag-warn {
  background: var(--warning-soft);
  color: var(--warning);
}

.tag-done {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.tone-danger { color: var(--danger); }
.tone-warn { color: var(--warning); }

/* =====================================================================
   画面が広いとき
   ---------------------------------------------------------------------
   スマホをそのまま引き伸ばしたように見せない。
   本文を広げつつ、読みやすさのため広げすぎない。
   ===================================================================== */

@media (min-width: 900px) {
  :root { --page-width: 1100px; }

  .home-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
  }

  .home-greeting-main { font-size: 24px; }

  .summary-tile { min-height: 96px; }
  .summary-tile-count { font-size: 30px; }
  .summary-tile-label { font-size: 13px; }
}

@media (min-width: 1280px) {
  :root { --page-width: 1240px; }
}

/* PCでは下部の固定ナビをやめ、ヘッダーの下に並べる。
   親指で届く必要が無く、画面下を占有する意味がないため。 */
@media (min-width: 900px) {
  .bottom-nav {
    position: static;
    border-top: 0;
    background: transparent;
    backdrop-filter: none;
    max-width: var(--page-width);
    margin: 0 auto;
    padding: 0 16px 6px;
    justify-content: flex-start;
    gap: 4px;
    height: auto;
  }

  .bottom-nav .nav-item {
    flex: none;
    flex-direction: row;
    gap: 6px;
    min-height: var(--tap);
    padding: 0 12px;
    border-radius: var(--radius-sm);
  }

  .bottom-nav .nav-item.is-active {
    background: var(--accent-soft);
    color: var(--accent-strong);
  }

  .bottom-nav .nav-icon { font-size: 15px; }
  .bottom-nav .nav-label { font-size: 14px; }

  body { padding-bottom: 24px; }
}

/* 動きを減らす設定にしている人には、余計なアニメーションを出さない */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* キーボード操作でどこにいるか分かるように */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}


/* ------------------------------------------------------ 通知のベル */

.header-bell { position: relative; padding-left: 10px; padding-right: 10px; }

.header-bell-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

/* ---------------------------------------------------- 通知センター */

.notice-list { list-style: none; margin: 12px 0 0; padding: 0; }

.notice-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.notice-item + .notice-item { margin-top: 8px; }

.notice-item.is-unread { border-left: 3px solid var(--accent); }
.notice-item.level-urgent { border-left: 3px solid var(--danger); }
.notice-item.level-important { border-left: 3px solid var(--warning); }

.notice-mark {
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-alt);
  font-size: 12px;
  font-weight: 700;
  margin-top: 2px;
}

.notice-item.level-urgent .notice-mark { background: var(--danger-soft); color: var(--danger); }
.notice-item.level-important .notice-mark { background: var(--warning-soft); color: var(--warning); }

.notice-body { flex: 1; min-width: 0; }

.notice-title {
  margin: 0;
  font-weight: 600;
  word-break: break-word;
}

.notice-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent);
  margin-right: 5px;
  vertical-align: middle;
}

.notice-text {
  margin: 2px 0 0;
  font-size: 14px;
  color: var(--text-muted);
  word-break: break-word;
}

.notice-meta {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.notice-actions {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tag-level-urgent { background: var(--danger-soft); color: var(--danger); }
.tag-level-important { background: var(--warning-soft); color: var(--warning); }
.tag-level-normal { background: var(--surface-alt); color: var(--text-muted); }

@media (max-width: 420px) {
  .notice-item { flex-wrap: wrap; }
  .notice-actions { flex-direction: row; width: 100%; }
}

/* ==========================================================================
   通知の設定
   ========================================================================== */

/* 「この端末で通知を受け取れるか」の枠。
   中身は static/js/push.js が状態に応じて書き換える。 */

.push-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-weight: 700;
  line-height: 1.4;
}

.push-badge-dot {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-alt);
  color: var(--text-muted);
  font-size: .85rem;
}

.push-badge.tone-ok .push-badge-dot { background: var(--accent-soft); color: var(--accent-strong); }
.push-badge.tone-warn .push-badge-dot { background: var(--warning-soft); color: var(--warning); }
.push-badge.tone-ok .push-badge-text { color: var(--accent-strong); }

.push-lead {
  margin: 0;
  font-size: .9rem;
  line-height: 1.7;
  color: var(--text-muted);
}

/* iPhone の「ホーム画面に追加」手順など。番号付きで順番に読める形にする。 */
.push-steps {
  margin: 10px 0 0;
  padding-left: 22px;
  font-size: .9rem;
  line-height: 1.9;
  color: var(--text);
}

.push-steps li { padding-left: 2px; }

.push-actions { margin-top: 12px; }

.push-status {
  margin: 10px 0 0;
  font-size: .85rem;
  line-height: 1.6;
  color: var(--text-muted);
  min-height: 1.2em;
}

.push-status.tone-ok { color: var(--accent-strong); }
.push-status.tone-warn { color: var(--warning); }

/* 登録済みの端末一覧 */
.device-list { list-style: none; margin: 0; padding: 0; }

.device-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

.device-item:first-child { border-top: 0; padding-top: 0; }
.device-name { font-weight: 600; font-size: .95rem; }
.device-meta { font-size: .8rem; color: var(--text-muted); }

/* --------------------------------------------------------------------------
   通知タイミングの選択

   以前はカンマ区切りの文字入力だった。iPhone の数字キーボードには
   カンマが無く入力できなかったため、押して選ぶ形にしている。
   中身はチェックボックスなので、JavaScript が無くても動く。
   -------------------------------------------------------------------------- */

.minutes-options {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
  padding: 0;
}

/* 実体のチェックボックスは隠すが、キーボード操作は残す */
.minutes-check {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.minutes-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  min-width: 76px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: .92rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.minutes-check:checked + .minutes-chip {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
}

/* キーボードで移動したときに、どれを選んでいるか分かるように */
.minutes-check:focus-visible + .minutes-chip {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.minutes-chip.is-custom::after {
  content: "";
}

.minutes-custom {
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.minutes-custom-label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.minutes-custom-input { max-width: 160px; }
.minutes-custom-help { margin-top: 6px; }

.minutes-summary {
  margin: 10px 0 0;
  font-size: .85rem;
  color: var(--text-muted);
}

/* ==========================================================================
   音声入力の状態表示
   ========================================================================== */

.quick-voice-status[hidden] { display: none; }
.quick-voice-status.tone-ok { color: var(--accent-strong); }
.quick-voice-status.tone-warn { color: var(--warning); }
.quick-voice-status.tone-muted { color: var(--text-muted); }

.quick-voice-status.tone-listening {
  color: var(--danger);
  font-weight: 600;
}

/* 聞いている間だけ、マイクがゆっくり脈打つ。
   「いま録っている」ことが目で分かるようにするため。 */
.quick-mic.is-listening {
  animation: mic-pulse 1.4s ease-in-out infinite;
}

@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--danger-soft); }
  50% { box-shadow: 0 0 0 6px var(--danger-soft); }
}

/* 動きを減らす設定にしている人には出さない */
@media (prefers-reduced-motion: reduce) {
  .quick-mic.is-listening { animation: none; }
}

/* ==========================================================================
   連携サービス（Googleと連携 / Microsoftと連携）
   ========================================================================== */

.account-card { padding-bottom: 4px; }

.account-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.account-identity { min-width: 0; }

.account-name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.account-status {
  margin: 3px 0 0;
  font-size: .85rem;
  color: var(--text-muted);
}

.account-status.tone-ok { color: var(--accent-strong); font-weight: 600; }

/* 接続したアカウント（メールアドレス）。折り返して全部見えるようにする。 */
.account-email {
  margin: 2px 0 0;
  font-size: .85rem;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.account-badge { flex: none; }

.account-description {
  margin: 10px 0 0;
  font-size: .9rem;
  line-height: 1.7;
  color: var(--text-muted);
}

/* 接続すると何が使えるようになるかの内訳 */
.account-services {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  border-top: 1px solid var(--border);
}

.account-service {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
}

.account-service-mark {
  flex: none;
  width: 20px;
  text-align: center;
  color: var(--text-muted);
}

.account-service.is-on .account-service-mark { color: var(--accent); }
.account-service-name { flex: 1; min-width: 0; }

.account-service-state {
  flex: none;
  font-size: .8rem;
  color: var(--text-muted);
}

.account-meta {
  margin: 10px 0 0;
  font-size: .8rem;
  color: var(--text-muted);
}

.account-blocker {
  margin: 10px 0 0;
  font-size: .88rem;
  line-height: 1.6;
  color: var(--warning);
}

.account-note {
  margin: 10px 0 0;
  font-size: .8rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.account-actions { margin-top: 14px; }

/* 未接続のときの主役ボタン。押す場所が1つだと分かるように大きくする。 */
.account-connect {
  min-height: 50px;
  font-size: 1rem;
}

.notice-inline { margin: 10px 0 0; }

/* --------------------------------------------------------- 折りたたみ枠 */

.details-block {
  margin-top: 24px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.details-summary {
  min-height: var(--tap);
  display: flex;
  align-items: center;
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.details-summary::-webkit-details-marker { color: var(--text-muted); }

/* 未読メールの件名を太くする（inline style を減らすため CSS へ移した） */
.event-title.is-unread { font-weight: 700; }

/* 縦に並べるボタンの列。連携ボタンのように、1つずつ大きく見せたいとき。 */
.btn-row-stack {
  flex-direction: column;
  align-items: stretch;
}

/* ==========================================================================
   設定画面
   ========================================================================== */

/* 項目名の下に説明を出すので、縦に積む。
   小さい文字が横に伸びて読みにくくならないよう、幅を残す。 */
.list-link > span:first-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.list-link small { line-height: 1.5; }

/* 右側の状態表示（ON / 未設定 / 接続済み）。押す前に状態が分かるように。 */
.settings-state {
  flex: none;
  display: inline-flex;
  align-items: center;
}
