/*
  共通の見た目（持ち主が見せた「アプリの小さな動き16選」の画像のような、やわらかく見やすい見た目）
  - 背景は薄い灰色（--page-bg）。中身は白いカード（角丸12px・細い枠線・ごく薄い影）。
  - 主な色は藍色（--primary）：主なボタン・切り替えのオン・進み具合・選んだもの。押せないものは灰色。
  - 文字は濃い紺（--ink）、補助の文字と線は灰色。
  - 赤（--alert）は「未処理」など、すぐ対応が要るものだけ（.badge--alert・.notice--alert）と、入力の誤り・危険な操作。
  - 日付が変わるところは .date-sep（濃い紺に白文字の帯）。
  - 動きは必要なものだけ（ボタンが少し沈む・トースト・回る印→チェック・シェイク・ボトムシート・スケルトン・
    プルトゥリフレッシュ・トグルスイッチ・進み具合・ダイアログ）。150〜300ms。prefers-reduced-motion のときは動かさない。
  - スマホ幅（390px）でも崩れないこと。

  使い方：<link rel="stylesheet" href="/common.css">  動きの関数は /common/ui.js（使い方は /common/README.md）
  見本：/common/sample.html

  今の画面が使っている class 名（.card・.btn・.badge・.notice・.date-sep・.field・.table・.list__item など）は、
  名前を変えずに新しい見た目にしてあります。古い変数（--black・--gray-1〜4・--red・--radius）も残しています。
*/

:root {
  /* ---- 色 ---- */
  --page-bg: #f3f4f8;      /* ページの背景（薄い灰色） */
  --surface: #ffffff;      /* カード・入力欄 */
  --surface-2: #f7f8fb;    /* ごく薄い塗り（触れたとき・表の見出し） */
  --surface-3: #eceef4;    /* 押したとき・押せないもの・骨組み */
  --line: #e3e5ee;         /* カードの細い枠線・区切り */
  --line-strong: #cdd1de;  /* 入力欄・ふつうのボタンの枠線 */
  --ink: #1d2140;          /* 文字（濃い紺） */
  --ink-2: #5d6283;        /* 補助の文字 */
  --ink-3: #9297ae;        /* 押せないものの文字・飾り */
  --primary: #4f55d8;      /* 藍色：押せるもの・オン・進み・選んだもの */
  --primary-hover: #464bca;
  --primary-press: #3c41b6;
  --primary-soft: #eef0fe; /* 藍色のうすい塗り */
  --primary-soft-2: #dde0fb;
  --primary-ink: #3a3fb3;  /* うすい藍色の上の文字 */
  --on-primary: #ffffff;
  --alert: #d92d3a;        /* 赤：すぐ対応が要るものだけ */
  --alert-soft: #fdeeef;
  --alert-line: #f4c3c7;
  --alert-ink: #b3202c;
  --tentative-soft: #fff3cf; /* 仮予約の印：黄色のうすい塗り（赤ではない。確定は濃い紺の塗り） */
  --tentative-line: #d9a520;
  --tentative-ink: #6b4a00;

  /* ---- 形 ---- */
  --radius: 12px;          /* カード */
  --radius-sm: 10px;       /* ボタン・入力欄 */
  --radius-lg: 18px;       /* ダイアログ・シート */
  --radius-pill: 999px;
  --shadow: 0 1px 2px rgba(29, 33, 64, 0.05), 0 2px 6px rgba(29, 33, 64, 0.04);
  --shadow-lg: 0 14px 36px rgba(29, 33, 64, 0.18), 0 2px 8px rgba(29, 33, 64, 0.08);
  --ring: 0 0 0 3px rgba(79, 85, 216, 0.28);
  --ring-alert: 0 0 0 3px rgba(217, 45, 58, 0.2);
  --gap: 12px;
  --topbar-h: 56px;

  /* ---- 動き ---- */
  --dur-fast: 150ms;
  --dur: 220ms;
  --dur-slow: 300ms;
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --font: system-ui, -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;

  /* ---- 前の名前（今の画面の CSS のため。新しく作る画面は上の名前を使う） ---- */
  --black: var(--ink);
  --white: #ffffff;
  --gray-1: var(--surface-2);
  --gray-2: var(--line);
  --gray-3: var(--line-strong);
  --gray-4: var(--ink-2);
  --red: var(--alert);

  color-scheme: light;
}

/* ======================================================================
   土台
   ====================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html.ui-modal-open { overflow: hidden; }
html.ui-pulling, html.ui-pulling body { user-select: none; -webkit-user-select: none; }
.ptr-host { overscroll-behavior-y: contain; }

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4 { line-height: 1.35; margin: 1.2em 0 0.5em; font-weight: 700; color: var(--ink); }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0.5em 0; }
a { color: var(--primary-ink); text-decoration: underline; text-decoration-color: rgba(79, 85, 216, 0.4); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
img { max-width: 100%; height: auto; }
svg { flex-shrink: 0; }
::selection { background: var(--primary-soft-2); }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ======================================================================
   レイアウト
   ====================================================================== */
.container { max-width: 1120px; margin: 0 auto; padding: 16px; }
.container--narrow { max-width: 480px; margin: 0 auto; padding: 16px; }
.stack > * + * { margin-top: var(--gap); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.spacer { flex: 1 1 auto; }
/* 列は中身（横にスクロールする表など）に押し広げられないように minmax(0, 1fr) */
.grid-2, .grid-3 { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr); }
.grid-2b { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); } /* スマホでも2列 */
@media (min-width: 720px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.grid-2 > .card + .card, .grid-3 > .card + .card, .grid-2b > .card + .card { margin-top: 0; }

/* ======================================================================
   上の帯（戻る・題名・ベルと未読の数）
   ====================================================================== */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 4px;
  min-height: var(--topbar-h);
  padding: 6px 8px; padding-top: max(6px, env(safe-area-inset-top));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar__title {
  flex: 1 1 auto; min-width: 0; margin: 0 8px;
  font-size: 1.05rem; font-weight: 700; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar__back + .topbar__title { margin-left: 2px; }
.topbar__nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.topbar__nav::-webkit-scrollbar { display: none; }
.topbar__nav a, .nav a {
  display: inline-flex; align-items: center; min-height: 36px; padding: 6px 12px;
  border-radius: var(--radius-pill); color: var(--ink-2); font-weight: 600; font-size: 0.92rem;
  text-decoration: none; white-space: nowrap;
  transition: background-color var(--dur-fast), color var(--dur-fast);
}
.topbar__nav a:hover, .nav a:hover { background: var(--surface-2); color: var(--ink); }
.topbar__nav a.is-active, .topbar__nav a[aria-current="page"],
.nav a.is-active, .nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary-ink); }
.topbar__actions { display: flex; align-items: center; gap: 2px; margin-left: auto; }

/* 前の上の帯（今の画面） */
.header {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.header__title { font-weight: 700; font-size: 1.05rem; margin: 0; }
.nav { display: flex; flex-wrap: wrap; gap: 2px 4px; }

/* 丸いアイコンのボタン（戻る・ベル・閉じる） */
.icon-btn {
  position: relative; display: inline-grid; place-items: center; flex: 0 0 auto;
  width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--ink);
  font: inherit; cursor: pointer; text-decoration: none;
  transition: background-color var(--dur-fast), transform var(--dur-fast) var(--ease);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { background: var(--surface-3); transform: scale(0.96); }
.icon-btn svg { width: 24px; height: 24px; }

/* ベルと未読の数（通知バッジ） */
.bell__count {
  position: absolute; top: 4px; right: 2px;
  min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 10px; background: var(--alert); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 19px; text-align: center;
  box-shadow: 0 0 0 2px var(--surface); pointer-events: none;
  font-variant-numeric: tabular-nums;
}

/* ======================================================================
   文字
   ====================================================================== */
.page-title { font-size: 1.35rem; margin: 8px 0 12px; }
.section-title { font-size: 1.02rem; margin: 24px 0 8px; color: var(--ink); }
.muted { color: var(--ink-2); }
.small { font-size: 0.875rem; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 700; }
.center { text-align: center; }
.right { text-align: right; }
.deleted { color: var(--ink-2); }
.empty { padding: 28px 12px; text-align: center; color: var(--ink-2); }

/* ======================================================================
   ボタン（押すと少し沈む・保存のボタンは回る印→チェック）
   ====================================================================== */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: 0.95rem; font-weight: 600; line-height: 1.25;
  text-align: center; text-decoration: none; cursor: pointer;
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast) var(--ease), background-color var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-fast);
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.98); background: var(--surface-3); }
.btn svg { width: 20px; height: 20px; }

/* 主なボタン（藍色） */
.btn--primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); box-shadow: 0 1px 2px rgba(79, 85, 216, 0.25); }
.btn--primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn--primary:active { background: var(--primary-press); border-color: var(--primary-press); }
/* 危険（削除・キャンセルなど）：赤い文字。.btn--primary と一緒なら赤く塗る（確認のダイアログの「はい」・選んだ「行けません」） */
.btn--danger { background: var(--surface); border-color: var(--alert-line); color: var(--alert-ink); }
.btn--danger:hover { background: var(--alert-soft); }
.btn--danger:active { background: #fbdfe1; }
.btn--danger.btn--primary { background: var(--alert); border-color: var(--alert); color: #fff; box-shadow: none; }
.btn--danger.btn--primary:hover { background: #c92633; border-color: #c92633; }
/* 枠なしの文字のボタン */
.btn--ghost { background: transparent; border-color: transparent; color: var(--primary-ink); box-shadow: none; }
.btn--ghost:hover { background: var(--primary-soft); }
/* 大きさ */
.btn--small { min-height: 34px; padding: 5px 12px; font-size: 0.85rem; gap: 6px; border-radius: 8px; }
.btn--small svg { width: 16px; height: 16px; }
.btn--big, .btn--large { min-height: 56px; padding: 12px 20px; font-size: 1.05rem; border-radius: var(--radius); }
.btn--block { display: flex; width: 100%; }
/* 押せない（灰色） */
.btn:disabled:not(.is-loading):not(.is-done),
.btn[aria-disabled="true"]:not(.is-loading):not(.is-done) {
  background: var(--surface-3); border-color: var(--surface-3); color: var(--ink-3);
  box-shadow: none; cursor: not-allowed; transform: none;
}
.btn.is-loading, .btn.is-done { cursor: default; }
.btn.is-loading:active, .btn.is-done:active { transform: none; }
.btn.is-done > svg { animation: ui-fade-in var(--dur-fast) ease-out; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* 回る印 */
.spinner {
  display: inline-block; flex: 0 0 auto;
  width: 1.15em; height: 1.15em; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: ui-spin 0.7s linear infinite;
}

/* ======================================================================
   入力欄（名前は欄の上。誤りは欄を揺らして、欄の下に赤で理由）
   ====================================================================== */
.field { display: block; position: relative; margin: 14px 0; }
.field > label, .field__label { display: block; font-weight: 600; font-size: 0.92rem; margin-bottom: 6px; color: var(--ink); }

input[type="text"], input[type="password"], input[type="email"], input[type="tel"], input[type="number"],
input[type="date"], input[type="time"], input[type="search"], input[type="url"], input[type="month"],
input[type="datetime-local"], input:not([type]), select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background-color: var(--surface); color: var(--ink);
  font: inherit; font-size: 16px; line-height: 1.5;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
select:not([multiple]) {
  -webkit-appearance: none; appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235d6283' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 18px;
}
textarea { min-height: 96px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:hover, select:hover, textarea:hover { border-color: #b9bed0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
input:disabled, select:disabled, textarea:disabled { background-color: var(--surface-2); color: var(--ink-3); border-color: var(--line); cursor: not-allowed; }
[aria-invalid="true"]:is(input, select, textarea) { border-color: var(--alert); }
[aria-invalid="true"]:is(input, select, textarea):focus { box-shadow: var(--ring-alert); }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; margin: 0; accent-color: var(--primary); vertical-align: middle; cursor: pointer; }

.help { color: var(--ink-2); font-size: 0.85rem; margin-top: 6px; }
.error { color: var(--alert-ink); font-size: 0.875rem; font-weight: 700; margin-top: 6px; }
.error::before { content: "！ "; }
/* シェイクのときに欄の下に出る理由（ui.js の shake()） */
.field__error {
  display: flex; align-items: flex-start; gap: 6px; margin-top: 6px;
  color: var(--alert-ink); font-size: 0.85rem; font-weight: 600; line-height: 1.4;
}
.field__error svg { width: 16px; height: 16px; margin-top: 1px; }

fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px 12px; margin: 14px 0; background: var(--surface); }
legend { font-weight: 700; padding: 0 6px; font-size: 0.92rem; }
.check { display: flex; gap: 10px; align-items: center; min-height: 40px; cursor: pointer; }

/* トグルスイッチ：オン・オフの設定。チェックボックスの代わり（一覧から複数選ぶところはチェックのまま）
   <label class="switch"><input type="checkbox" role="switch"><span class="switch__track"></span><span class="switch__label">未読だけ</span></label>
   設定の行（名前が左・スイッチが右）は .switch--row */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; user-select: none; -webkit-user-select: none; }
.switch > input { position: absolute; left: 0; top: 50%; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.switch__track {
  position: relative; flex: 0 0 auto; width: 48px; height: 28px; border-radius: 14px;
  background: #c8ccda; transition: background-color var(--dur) var(--ease), box-shadow var(--dur-fast);
}
.switch__track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(29, 33, 64, 0.25);
  transition: transform var(--dur) var(--ease);
}
.switch > input:checked + .switch__track { background: var(--primary); }
.switch > input:checked + .switch__track::after { transform: translateX(20px); }
.switch > input:focus-visible + .switch__track { box-shadow: var(--ring); }
.switch > input:disabled + .switch__track { opacity: 0.45; }
.switch:has(> input:disabled) { cursor: not-allowed; color: var(--ink-3); }
.switch__label { line-height: 1.4; }
.switch--row { display: flex; width: 100%; justify-content: space-between; }
.switch--row > .switch__track { order: 2; }
.switch--row > .switch__label { flex: 1 1 auto; }

/* ======================================================================
   カード・一覧
   ====================================================================== */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; min-width: 0;
}
.card--strong { border: 2px solid var(--ink); }
.card + .card { margin-top: var(--gap); }
.card__title { margin: 0 0 8px; font-size: 1rem; font-weight: 700; }
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { list-style: none; }
.list__item {
  display: block; position: relative; width: 100%;
  padding: 14px 16px; margin: 0 0 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  color: inherit; font: inherit; text-align: left; text-decoration: none;
  transition: transform var(--dur-fast) var(--ease), background-color var(--dur-fast);
}
a.list__item, button.list__item, label.list__item, .list__item[role="button"] { cursor: pointer; -webkit-tap-highlight-color: transparent; }
a.list__item:hover, button.list__item:hover, label.list__item:hover, .list__item[role="button"]:hover { background: #fbfbfd; }
a.list__item:active, button.list__item:active, .list__item[role="button"]:active { transform: scale(0.99); background: var(--surface-2); }
.list__title { font-weight: 700; }
.list__meta { color: var(--ink-2); font-size: 0.875rem; }
/* 右に「＞」（ほかの画面へ移る行） */
.list__item--chevron { padding-right: 40px; }
.list__item--chevron::after {
  content: ""; position: absolute; right: 14px; top: 50%; width: 18px; height: 18px; margin-top: -9px;
  background: var(--ink-3);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 5l7 7-7 7'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 5l7 7-7 7'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* 1枚のカードに行を並べる一覧（設定など） */
.list--group { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list--group > li { list-style: none; }
.list--group > li > .list__item, .list--group > .list__item {
  margin: 0; border: 0; border-radius: 0; box-shadow: none; border-bottom: 1px solid var(--line);
}
.list--group > li:last-child > .list__item, .list--group > .list__item:last-child { border-bottom: 0; }
.list--group > li > .switch--row { padding: 6px 16px; border-bottom: 1px solid var(--line); }
.list--group > li:last-child > .switch--row { border-bottom: 0; }

/* ======================================================================
   印（バッジ）・お知らせ・日付の帯
   ====================================================================== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 10px; margin: 1px 4px 1px 0;
  border: 1px solid transparent; border-radius: var(--radius-pill);
  background: var(--surface-3); color: var(--ink);
  font-size: 0.78rem; font-weight: 600; line-height: 1.6; white-space: nowrap; vertical-align: middle;
}
.badge svg { width: 14px; height: 14px; }
.badge--strong { background: var(--ink); color: #fff; }
.badge--muted { background: transparent; border-color: var(--line-strong); color: var(--ink-2); font-weight: 500; }
.badge--primary { background: var(--primary-soft); color: var(--primary-ink); }
.badge--alert { background: var(--alert); border-color: var(--alert); color: #fff; }
/* 仮と確定：色だけでなく、破線の枠と塗りつぶしでも分かるように */
.badge--tentative { background: var(--tentative-soft); border: 1.5px dashed var(--tentative-line); color: var(--tentative-ink); font-weight: 700; }
.badge--confirmed { background: var(--ink); color: #fff; }

.notice {
  padding: 12px 14px; margin: 12px 0;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
}
.notice > :first-child { margin-top: 0; }
.notice > :last-child { margin-bottom: 0; }
.notice--warn { background: var(--primary-soft); border-color: var(--primary-soft-2); color: var(--ink); font-weight: 600; }
.notice--warn a { color: var(--primary-ink); }
.notice--error { background: var(--alert-soft); border-color: var(--alert-line); color: var(--alert-ink); font-weight: 600; }
.notice--error::before { content: "！ "; }
.notice--alert { background: var(--alert-soft); border: 1px solid var(--alert-line); border-left: 4px solid var(--alert); color: var(--alert-ink); font-weight: 700; }
.notice--alert a { color: var(--alert-ink); }

/* 日付の帯：濃い紺に白文字。一覧の日付が変わるところに置く */
.date-sep {
  display: block; margin: 20px 0 8px; padding: 7px 14px;
  background: var(--ink); color: #fff;
  font-weight: 700; font-size: 0.95rem; line-height: 1.4; letter-spacing: 0.02em;
  border-radius: var(--radius-sm);
}
.date-sep:first-child { margin-top: 0; }

/* 管理者の代理ログイン中（今の画面） */
.proxy-banner {
  position: sticky; top: 0; z-index: 35;
  background: var(--ink); color: #fff;
  text-align: center; font-weight: 700; padding: 6px 12px; letter-spacing: 0.05em;
}

/* ======================================================================
   表
   ====================================================================== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }
.table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  font-size: 0.92rem;
}
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
.table thead th { background: var(--surface-2); color: var(--ink-2); font-size: 0.8rem; font-weight: 700; white-space: nowrap; }
.table tbody tr:last-child > * { border-bottom: 0; }
.table tfoot th, .table tfoot td { border-top: 1px solid var(--line-strong); border-bottom: 0; background: var(--surface-2); font-weight: 700; }
.table th.num, .table td.num { text-align: right; }
.table--compact th, .table--compact td { padding: 5px 8px; font-size: 0.85rem; }
.table tr.is-selected td { background: var(--primary-soft); }

/* ======================================================================
   タブ
   ====================================================================== */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs > a, .tabs > button {
  flex: 0 0 auto; margin-bottom: -1px; padding: 10px 14px;
  border: 0; border-bottom: 3px solid transparent; background: transparent;
  color: var(--ink-2); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: color var(--dur-fast), border-color var(--dur-fast);
}
.tabs > a:hover, .tabs > button:hover { color: var(--ink); }
.tabs > .is-active, .tabs > [aria-selected="true"], .tabs > [aria-current="page"] { color: var(--primary-ink); border-bottom-color: var(--primary); }

/* ======================================================================
   ダイアログ（確認・PC の入力）・ボトムシート（委託先アプリで選ぶとき）
   ====================================================================== */
dialog {
  border: 0; border-radius: var(--radius-lg); padding: 20px;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg);
  max-width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto;
}
dialog::backdrop { background: rgba(29, 33, 64, 0.45); }
dialog[open] { animation: ui-dialog-in var(--dur) var(--ease-out); }
dialog[open]::backdrop { animation: ui-fade-in var(--dur) ease-out; }
dialog.is-closing { animation: ui-dialog-out var(--dur-fast) ease-in forwards; }
dialog.is-closing::backdrop { animation: ui-fade-out var(--dur-fast) ease-in forwards; }
dialog.dialog { width: min(440px, calc(100vw - 32px)); }
dialog.dialog--wide { width: min(920px, calc(100vw - 32px)); max-width: min(920px, calc(100vw - 32px)); }
.dialog__title { margin: 0 0 8px; font-size: 1.12rem; font-weight: 700; }
.dialog__body > :first-child { margin-top: 0; }
.dialog__body > :last-child { margin-bottom: 0; }
.dialog__body p { white-space: pre-wrap; }
.dialog__error:empty { display: none; }
.dialog__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 20px; }
@media (max-width: 480px) {
  .dialog__actions { flex-direction: column-reverse; }
  .dialog__actions > .btn { width: 100%; }
}

dialog.sheet {
  width: 100%; max-width: 560px; margin: auto auto 0; padding: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  max-height: min(86dvh, 760px); overflow: hidden;
}
dialog.sheet[open] { display: flex; flex-direction: column; animation: ui-sheet-in var(--dur-slow) var(--ease-out); }
dialog.sheet.is-closing { animation: ui-sheet-out var(--dur) ease-in forwards; }
dialog.sheet.is-returning { transition: transform var(--dur) var(--ease); }
.sheet__grab { flex: none; padding: 8px 0 2px; cursor: grab; touch-action: none; }
.sheet__handle { width: 40px; height: 5px; margin: 0 auto; border-radius: 3px; background: var(--line-strong); }
.sheet__head { flex: none; display: flex; align-items: center; gap: 8px; padding: 2px 8px 2px 20px; min-height: 48px; touch-action: none; }
.sheet__title { flex: 1 1 auto; margin: 0; font-size: 1.05rem; font-weight: 700; }
.sheet__body { flex: 1 1 auto; overflow: auto; overscroll-behavior: contain; padding: 4px 12px calc(16px + env(safe-area-inset-bottom)); }
.sheet__body > .field, .sheet__body > .btn, .sheet__body > p, .sheet__body > form, .sheet__body > .btn-row { margin-left: 8px; margin-right: 8px; }
.sheet__body > .btn--block { width: calc(100% - 16px); }
.sheet__options { list-style: none; margin: 0; padding: 0; }
.sheet__option {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 12px;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink);
  font: inherit; font-size: 1rem; text-align: left; cursor: pointer;
  transition: background-color var(--dur-fast), transform var(--dur-fast) var(--ease);
}
.sheet__option:hover { background: var(--surface-2); }
.sheet__option:active { background: var(--surface-3); transform: scale(0.99); }
.sheet__option:disabled { color: var(--ink-3); cursor: not-allowed; background: transparent; }
.sheet__option > svg:first-child { width: 22px; height: 22px; color: var(--ink-2); }
.sheet__option-text { flex: 1 1 auto; min-width: 0; }
.sheet__option-label { display: block; font-weight: 600; }
.sheet__option-desc { display: block; font-size: 0.85rem; color: var(--ink-2); }
.sheet__option-check { display: grid; color: var(--primary); visibility: hidden; }
.sheet__option-check svg { width: 22px; height: 22px; }
.sheet__option[aria-current="true"] { background: var(--primary-soft); color: var(--primary-ink); }
.sheet__option[aria-current="true"] .sheet__option-check { visibility: visible; }
.sheet__option--danger, .sheet__option--danger > svg:first-child { color: var(--alert-ink); }

/* ======================================================================
   トースト：上から短く知らせる
   ====================================================================== */
/* ui.js が popover にして、開いているダイアログの上にも出す（ブラウザの popover の既定の見た目は消す） */
.toast-stack {
  position: fixed; z-index: 1000; inset: auto; left: 50%; top: max(12px, env(safe-area-inset-top));
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: min(440px, calc(100vw - 32px)); height: auto; margin: 0; padding: 0;
  border: 0; background: transparent; color: inherit; overflow: visible; pointer-events: none;
}
.toast-stack > .toast {
  position: relative; inset: auto; z-index: auto;
  display: flex; align-items: center; gap: 10px; max-width: 100%;
  padding: 11px 16px 11px 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg);
  font-size: 0.95rem; font-weight: 600; line-height: 1.45;
  pointer-events: auto; cursor: pointer;
  animation: ui-toast-in var(--dur-slow) var(--ease-out);
}
.toast-stack > .toast.is-leaving { animation: ui-toast-out var(--dur) ease-in forwards; }
.toast__icon { display: grid; place-items: center; flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff; }
.toast__icon svg { width: 16px; height: 16px; }
.toast--info .toast__icon { background: var(--ink-2); }
.toast--error .toast__icon { background: var(--alert); }
.toast--error { border-color: var(--alert-line); }

/* ======================================================================
   スケルトン：読み込み中の骨組み
   ====================================================================== */
.skeleton__card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 8px; box-shadow: var(--shadow); }
.skeleton__line, .skeleton__pill, .skeleton__block {
  display: block; height: 12px; border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-3) 0%, #f7f8fb 45%, var(--surface-3) 90%);
  background-size: 300% 100%;
  animation: ui-shimmer 1.3s ease-in-out infinite;
}
.skeleton__line + .skeleton__line { margin-top: 10px; }
.skeleton__line--title { height: 16px; width: 58%; }
.skeleton__line--short { width: 34%; }
.skeleton__line--long { width: 86%; }
.skeleton__pill { width: 64px; height: 20px; border-radius: 10px; margin-top: 12px; }
.skeleton__block { height: 120px; border-radius: var(--radius-sm); }
.skeleton__sep { display: block; width: 140px; height: 32px; border-radius: var(--radius-sm); margin: 0 0 8px; background: #d9dbe5; }

/* ======================================================================
   進み具合（写真のアップロード・PDF を送るあいだ）：細い棒（.progress）とリング（.progress-ring）
   ====================================================================== */
.progress { display: flex; align-items: center; gap: 10px; }
.progress__track { position: relative; flex: 1 1 auto; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.progress__bar { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: inherit; background: var(--primary); transition: width var(--dur) var(--ease); }
.progress__value { flex: 0 0 auto; min-width: 3.2em; text-align: right; font-size: 0.8rem; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.progress.is-done .progress__value { display: inline-grid; place-items: center; min-width: 0; width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: #fff; }
.progress.is-done .progress__value svg { width: 14px; height: 14px; }

.progress-ring { position: relative; display: inline-grid; place-items: center; width: var(--ring-size, 56px); height: var(--ring-size, 56px); vertical-align: middle; }
.progress-ring > svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.progress-ring__track { stroke: var(--surface-3); }
.progress-ring__bar { stroke: var(--primary); stroke-linecap: round; transition: stroke-dashoffset var(--dur) var(--ease); }
.progress-ring__value { position: relative; font-size: 0.75rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.progress-ring.is-done .progress-ring__value { display: grid; place-items: center; width: 62%; height: 62%; border-radius: 50%; background: var(--primary); color: #fff; }
.progress-ring.is-done .progress-ring__value svg { width: 60%; height: 60%; }

/* 案件の進み（行けます→向かいます→到着→会計→写真）：<ol class="steps"><li>行けます</li>…</ol> → ui.js の steps() */
.steps { display: flex; margin: 0; padding: 0; list-style: none; }
.steps > li {
  position: relative; flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  color: var(--ink-2); font-size: 0.78rem; font-weight: 600; text-align: center; line-height: 1.3;
}
.steps > li::before {
  content: ""; position: absolute; z-index: 0; top: 13px; right: 50%; width: 100%; height: 2px;
  background: var(--line-strong);
}
.steps > li:first-child::before { display: none; }
.steps__dot {
  position: relative; z-index: 1; display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--line-strong); background: var(--surface); color: #fff;
}
.steps__dot svg { width: 16px; height: 16px; }
.steps__label { word-break: keep-all; overflow-wrap: anywhere; }
.steps > li.is-done { color: var(--ink); }
.steps > li.is-done::before { background: var(--primary); }
.steps > li.is-done .steps__dot { background: var(--primary); border-color: var(--primary); }
.steps > li[aria-current="step"] { color: var(--primary-ink); }
.steps > li[aria-current="step"]::before { background: var(--primary); }
.steps > li[aria-current="step"] .steps__dot { border-color: var(--primary); box-shadow: var(--ring); }

/* ======================================================================
   シェイク（入力の誤り）
   ====================================================================== */
.is-shaking { animation: ui-shake var(--dur-slow) cubic-bezier(0.36, 0.07, 0.19, 0.97); }

/* ======================================================================
   プルトゥリフレッシュ：下に引いて更新（説明の文は出さない）
   ====================================================================== */
.pull-indicator {
  --pull: 0px;
  position: fixed; z-index: 40; left: 50%; top: 0;
  display: grid; place-items: center; width: 40px; height: 40px; margin-left: -20px;
  border-radius: 50%; background: var(--surface); color: var(--ink-2);
  box-shadow: 0 2px 10px rgba(29, 33, 64, 0.18); pointer-events: none; opacity: 0;
  transform: translateY(calc(var(--pull) - 44px));
}
.pull-indicator.is-settling { transition: transform var(--dur) var(--ease), opacity var(--dur); }
.pull-indicator.is-ready { color: var(--primary); }
.pull-indicator__arrow { display: grid; }
.pull-indicator__arrow svg { width: 22px; height: 22px; }
.pull-indicator .spinner { display: none; width: 20px; height: 20px; color: var(--primary); }
.pull-indicator.is-refreshing .spinner { display: inline-block; }
.pull-indicator.is-refreshing .pull-indicator__arrow { display: none; }

/* ======================================================================
   カレンダー（Googleカレンダーのモック・空き状況）
   ====================================================================== */
.cal { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 0.85rem; background: var(--surface); }
.cal th, .cal td { border: 1px solid var(--line); padding: 4px; vertical-align: top; }
.cal thead th { background: var(--surface-2); color: var(--ink-2); }
.cal .is-today { outline: 2px solid var(--primary); outline-offset: -2px; }
.ev { display: block; margin: 2px 0; padding: 2px 6px; border-radius: 6px; font-size: 0.8rem; line-height: 1.35; word-break: break-all; }
/* 仮予約：白地に破線の枠（題名の頭に【仮予約】） */
.ev--tentative { border: 2px dashed var(--primary); background: var(--surface); color: var(--primary-ink); }
/* 確定：藍色の塗りつぶしに白文字 */
.ev--confirmed { border: 2px solid var(--primary); background: var(--primary); color: #fff; }
/* 休み：灰色の地に点線の枠 */
.ev--off { border: 1px dotted var(--ink-2); background: var(--surface-3); color: var(--ink); }
/* そのほかの予定：細い実線の枠 */
.ev--other { border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); }
/* 予定が消えた・動いた警告：赤の二重線 */
.ev--alert { border: 4px double var(--alert); background: var(--surface); color: var(--alert-ink); font-weight: 700; }

/* 空き状況の印（○ × － 休） */
.mark { display: inline-block; min-width: 2em; text-align: center; font-weight: 700; font-size: 1.1rem; }
.mark--ok { border: 2px solid var(--primary); color: var(--primary-ink); border-radius: 50%; width: 2em; height: 2em; line-height: 1.8em; font-size: 0.95rem; }
.mark--ng { color: var(--ink-3); font-weight: 400; }
.mark--off { background: var(--surface-3); border-radius: 6px; }
button.mark { border: 0; background: none; font: inherit; cursor: pointer; }
button.mark--ok { border: 2px solid var(--primary); background: var(--surface); transition: background-color var(--dur-fast), transform var(--dur-fast) var(--ease); }
button.mark--ok:active { transform: scale(0.96); }
button.mark--ok[aria-pressed="true"] { background: var(--primary); color: #fff; }

/* ======================================================================
   そのほか
   ====================================================================== */
.hidden { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 4px !important; }
.mt-2 { margin-top: 8px !important; }
.mt-3 { margin-top: 16px !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 4px !important; }
.mb-2 { margin-bottom: 8px !important; }
.mb-3 { margin-bottom: 16px !important; }

/* ======================================================================
   動きの型
   ====================================================================== */
@keyframes ui-spin { to { transform: rotate(360deg); } }
@keyframes ui-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}
@keyframes ui-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes ui-fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes ui-dialog-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes ui-dialog-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: scale(0.98); } }
@keyframes ui-sheet-in { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes ui-sheet-out { from { transform: translateY(var(--drag, 0px)); } to { transform: translateY(100%); } }
@keyframes ui-toast-in { from { opacity: 0; transform: translateY(-18px); } to { opacity: 1; transform: none; } }
@keyframes ui-toast-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-14px); } }
@keyframes ui-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* 動きを減らす設定のときは動かさない */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important;
    transition-duration: 1ms !important; transition-delay: 0s !important; scroll-behavior: auto !important;
  }
  .btn:active, .icon-btn:active, .list__item:active, .sheet__option:active, button.mark--ok:active { transform: none !important; }
  .spinner, .skeleton__line, .skeleton__pill, .skeleton__block { animation: none !important; }
}

/* ======================================================================
   スマホ幅・印刷
   ====================================================================== */
@media (max-width: 480px) {
  body { font-size: 15px; }
  .container, .container--narrow { padding: 12px 16px; }
  .card { padding: 14px; }
  .table th, .table td { padding: 8px 8px; }
}

@media print {
  .no-print, .header, .nav, .btn, .tabs, .proxy-banner, .topbar, .toast-stack, .pull-indicator { display: none !important; }
  body { font-size: 11pt; background: #fff; }
  .container, .container--narrow { max-width: none; padding: 0; }
  .card, .list__item { box-shadow: none; break-inside: avoid; }
  a { text-decoration: none; color: inherit; }
}
