/*
  管理画面だけの見た目（/common.css に足りない分だけ）
  - パソコンで操作する前提（2026-12-01 持ち主の決定）：左の縦のメニュー・上の帯・画面の幅を広く使う表・案件の画面は2列。
  - スマホ（390px）は緊急用：メニューは左から出し、表は横にスクロールする。スマホ向けの作り込みはしない。
  - 色・カード・ボタン・入力欄・印・お知らせ・表・ダイアログ・トースト・日付の帯は共通の見た目を使う。
*/

:root { --side-w: 212px; --main-pad: 28px; }

/* ======================================================================
   骨組み：左のメニュー ＋（上の帯・中身）
   ====================================================================== */
.admin-shell {
  display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh;
  /* 左のメニューの白い帯は、ページの下まで続ける */
  background: linear-gradient(90deg, var(--surface) 0 calc(var(--side-w) - 1px), var(--line) calc(var(--side-w) - 1px) var(--side-w), transparent var(--side-w));
}
.admin-col { min-width: 0; display: flex; flex-direction: column; }
.admin-main { flex: 1 1 auto; width: 100%; max-width: 1760px; padding: 20px var(--main-pad) 56px; outline: none; }

/* 左の縦のメニュー */
.admin-side {
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
  display: flex; flex-direction: column; padding: 0 10px 16px;
  background: var(--surface); border-right: 1px solid var(--line);
}
.admin-side__brand {
  display: flex; align-items: center; flex: none; min-height: var(--topbar-h); margin: 0 -10px 4px; padding: 0 22px;
  border-bottom: 1px solid var(--line); color: var(--ink); font-weight: 700; font-size: 1.05rem; text-decoration: none;
}
.admin-side__group { list-style: none; margin: 0; padding: 6px 0; }
.admin-side__group + .admin-side__group { border-top: 1px solid var(--line); }
.admin-side__group a {
  display: flex; align-items: center; min-height: 38px; padding: 6px 12px; margin: 1px 0;
  border-radius: var(--radius-sm); color: var(--ink-2); font-weight: 600; font-size: 0.93rem; text-decoration: none;
  transition: background-color var(--dur-fast), color var(--dur-fast);
}
.admin-side__group a:hover { background: var(--surface-2); color: var(--ink); }
.admin-side__group a[aria-current="page"] { background: var(--primary-soft); color: var(--primary-ink); }
.admin-side__foot { display: none; }
.admin-backdrop { display: none; }

/* 上の帯：（狭いとき ☰・題）・デモの今日 …… ベル・名前・ログアウト */
.admin-bar { gap: 8px; padding-left: var(--main-pad); padding-right: 16px; }
.admin-menu-btn, .admin-brand { display: none; }
.admin-brand { font-weight: 700; font-size: 1.05rem; color: var(--ink); text-decoration: none; white-space: nowrap; }
.admin-today {
  display: inline-flex; align-items: center; min-height: 30px; padding: 2px 12px;
  border-radius: var(--radius-pill); background: var(--surface-2); border: 1px solid var(--line);
  color: var(--ink-2); font-size: 0.85rem; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.admin-today:hover { background: var(--surface-3); }
.admin-bar .topbar__actions { gap: 4px; }
.admin-account { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 10px; color: var(--ink); font-size: 0.9rem; font-weight: 600; text-decoration: none; white-space: nowrap; border-radius: var(--radius-sm); }
.admin-account:hover { background: var(--surface-2); }
.admin-role { color: var(--ink-2); font-weight: 500; font-size: 0.8rem; }

/* 狭いとき（1023px まで）：メニューは ☰ で左から出す */
@media (max-width: 1023px) {
  :root { --main-pad: 16px; }
  .admin-shell { grid-template-columns: minmax(0, 1fr); background: none; }
  .admin-side {
    position: fixed; z-index: 60; left: 0; top: 0; bottom: 0; width: min(280px, 85vw);
    transform: translateX(-100%); visibility: hidden; box-shadow: none;
    transition: transform var(--dur) var(--ease), visibility 0s linear var(--dur);
  }
  .admin-side.is-open { transform: none; visibility: visible; box-shadow: var(--shadow-lg); transition: transform var(--dur) var(--ease); }
  .admin-backdrop.is-open { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(29, 33, 64, 0.35); }
  .admin-menu-btn { display: inline-grid; margin-left: -6px; }
  .admin-brand { display: inline; }
  .admin-bar { padding-left: 12px; padding-right: 8px; }
  .admin-main { padding: 14px var(--main-pad) 48px; }
}
@media (max-width: 640px) {
  .admin-bar .admin-account, .admin-bar .admin-logout { display: none; }
  .admin-side__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: auto; padding: 12px 4px 0; border-top: 1px solid var(--line); }
}

/* ======================================================================
   ログイン
   ====================================================================== */
.login-page { display: grid; place-items: center; min-height: 100dvh; padding: 16px; }
.login-card { width: min(400px, 100%); padding: 24px; }
.login-card__title { margin: 0 0 8px; font-size: 1.3rem; text-align: center; }

/* ======================================================================
   見出し・戻る・カードの頭
   ====================================================================== */
.title-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 0 0 14px; }
.title-row .page-title { margin: 0; }
.title-row .section-title { margin: 0; }
.title-row > .btn-row { margin-left: auto; }
.title-row__count { color: var(--ink-2); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.back-link { display: inline-flex; align-items: center; gap: 2px; margin: 0 0 4px -4px; padding: 2px 8px 2px 4px; border-radius: var(--radius-sm); color: var(--ink-2); font-weight: 600; font-size: 0.88rem; text-decoration: none; }
.back-link:hover { background: var(--surface-3); color: var(--ink); }
.back-link svg { width: 18px; height: 18px; }
.card-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin: 0 0 10px; }
.card-head .card__title { margin: 0; }
.subhead { font-size: 0.95rem; margin: 16px 0 6px; }
.ml-1 { margin-left: 6px; }
.form-end { margin-top: 16px; }
.pre { white-space: pre-wrap; }

/* 段（カードを縦に並べる箱）と、パソコンの2列 */
.col { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.col > .card + .card, .col > * + .card { margin-top: 0; }
.cols { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr); align-items: start; }
.cols > .card + .card { margin-top: 0; }
@media (min-width: 1280px) {
  .cols--side-main { grid-template-columns: minmax(300px, 420px) minmax(0, 1fr); }
  .cols--half { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* 左が広い2列（案件の画面・新規作成・委託先）は、左の表が入る幅から */
@media (min-width: 1360px) {
  .cols--main-side { grid-template-columns: minmax(0, 1.7fr) minmax(380px, 1fr); }
}
.admin-main :is(.card, .grid-2, .cols, .table-wrap) + .cols, .admin-main .cols + :is(.card, .cols, .grid-2) { margin-top: var(--gap); }

/* ======================================================================
   絞り込みの帯（表の上に1行。幅が足りなければ折り返す）
   ====================================================================== */
.fbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.fbar input, .fbar select { width: auto; min-height: 38px; padding: 6px 10px; font-size: 0.9rem; }
.fbar select:not([multiple]) { padding-right: 30px; background-position: right 9px center; background-size: 16px; max-width: 10.5em; }
.fbar input[type="date"] { width: 9em; }
/* さがす欄は、あいた幅に合わせて伸び縮みする（帯をなるべく1行に） */
.fbar input[type="search"] { flex: 1 1 8em; min-width: 8em; max-width: 20em; width: auto; }
.fbar input[inputmode="numeric"] { width: 7em; }
.fbar .btn { min-height: 38px; padding: 6px 14px; font-size: 0.9rem; }
.fbar .switch { min-height: 38px; font-size: 0.9rem; }
.fbar__group { display: inline-flex; align-items: center; gap: 4px; }
.fbar__end { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.fbar .tabs { border-bottom: 0; }
.fbar .tabs > a { padding: 6px 12px; }

/* 並んだ切り替え（今日・明日・今週…） */
.seg { display: inline-flex; flex: none; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.seg > a {
  display: inline-flex; align-items: center; min-height: 36px; padding: 4px 10px;
  border-left: 1px solid var(--line); color: var(--ink-2); font-weight: 600; font-size: 0.88rem; text-decoration: none; white-space: nowrap;
  transition: background-color var(--dur-fast), color var(--dur-fast);
}
.seg > a:first-child { border-left: 0; }
.seg > a:hover { background: var(--surface-2); color: var(--ink); }
.seg > a[aria-current="true"] { background: var(--primary-soft); color: var(--primary-ink); }

/* ======================================================================
   表（一覧）
   ====================================================================== */
.card .table td { vertical-align: middle; }
.table--list td { vertical-align: middle; }
.table--list td, .table--list th { padding: 9px 10px; }
.table tr.is-link { cursor: pointer; }
.table tr.is-link:hover > td { background: #f8f8fd; }
.table tr.is-link > td > a.row-link { color: var(--ink); font-weight: 700; text-decoration: none; }
.table tr.is-link > td > a.row-link:hover, .table tr.is-link > td > a.row-link:focus-visible { color: var(--primary-ink); text-decoration: underline; }
.table tr.is-muted > td { color: var(--ink-2); background: var(--surface-2); }
.table tr.is-voided td { color: var(--ink-3); background: var(--surface-2); }
.table tr.date-row > th {
  background: var(--ink); color: #fff; padding: 6px 12px; font-size: 0.9rem; font-weight: 700; letter-spacing: 0.02em;
  border-bottom: 0; white-space: nowrap;
}
.table tbody tr.date-row + tr > td { border-top: 0; }
.cell-actions { white-space: nowrap; text-align: right; }
.cell-actions .btn + .btn { margin-left: 4px; }
.cell-badges { display: flex; flex-wrap: wrap; gap: 2px; }
.cell-badges .badge { margin: 0; }
.cell-sub { display: block; color: var(--ink-2); font-size: 0.8rem; }
.table td .cell-select { min-height: 34px; padding: 4px 30px 4px 8px; font-size: 0.88rem; width: auto; min-width: 8em; max-width: 13em; background-position: right 8px center; background-size: 16px; }
.cell-select.is-alert { border-color: var(--alert); color: var(--alert-ink); font-weight: 700; }
.strike { text-decoration: line-through; }
.num-sub { display: block; font-size: 0.78rem; color: var(--ink-2); font-weight: 500; }
.letter { display: inline-block; min-width: 1.3em; font-weight: 700; color: var(--ink-2); }

/* 案件の一覧の列 */
.jobs-table .c-menu { min-width: 8em; }
.jobs-table .c-share { min-width: 10em; }
.jobs-table .c-st { min-width: 10em; }

/* 見出しの行を上の帯の下に残す（パソコンの長い一覧。表が幅に入りきる 1360px から） */
@media (min-width: 1360px) {
  .table-wrap--sticky { overflow: visible; }
  .table-wrap--sticky > .table { overflow: clip; }
  .table-wrap--sticky > .table > thead th { position: sticky; top: var(--topbar-h); z-index: 2; box-shadow: 0 1px 0 var(--line); }
}

/* ======================================================================
   ホーム（件数と知らせ）
   ====================================================================== */
/* ホームのタスクの一覧（左にタスクの名前の印、右に件数と「›」） */
.task-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; }
.task-row .badge { margin: 0; font-size: 0.86rem; padding: 3px 12px; white-space: normal; }
.task-row__count { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* 案件の一覧：タスクで絞り込んだときの見出し（名前と「？」） */
.task-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; }
.task-head__label { font-size: 0.85rem; font-weight: 600; color: var(--ink-2); }
.task-head .badge { margin: 0; font-size: 0.86rem; padding: 3px 12px; }
.help-btn { min-width: 34px; padding-left: 0; padding-right: 0; border-radius: var(--radius-pill); font-weight: 700; }
/* 案件の画面のタスクの印：押すと説明が開く（ボタンの見た目を少し） */
button.badge--btn { font: inherit; font-size: 0.78rem; font-weight: 600; cursor: pointer; box-shadow: 0 1px 0 rgba(29, 33, 64, 0.18); }
button.badge--btn::after { content: "？"; margin-left: 2px; font-size: 0.72rem; opacity: 0.85; }
button.badge--btn:hover { filter: brightness(0.95); }
button.badge--btn:focus-visible { outline: none; box-shadow: var(--ring); }
@media (max-width: 640px) {
  .help-btn { min-width: 44px; min-height: 44px; }
  button.badge--btn { min-height: 44px; padding: 3px 12px; }
}

/* 知らせ：日付の帯 ＋ 1枚のカードに行を並べる */
.notif-day + .notif-day { margin-top: 14px; }
.notif-day > .date-sep { margin: 0 0 6px; }
.notif { padding: 10px 40px 10px 16px; }
.notif__head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.notif__title { font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.notif__title--alert { color: var(--alert-ink); }
.notif__title svg { width: 18px; height: 18px; color: var(--alert); }
.notif__time { margin-left: auto; color: var(--ink-2); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.notif__body { margin-top: 2px; color: var(--ink-2); font-size: 0.88rem; white-space: pre-wrap; }
.notif--unread { box-shadow: inset 4px 0 0 var(--primary); }
.notif--unread .notif__title { font-weight: 700; }
div.notif { padding-right: 16px; }
.notif-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-left: auto; }
.notif-tools .switch { min-height: 36px; }

/* ======================================================================
   項目と値
   ====================================================================== */
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; }
.kv dt { color: var(--ink-2); font-size: 0.88rem; padding-top: 1px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) { .kv { grid-template-columns: 6.5em minmax(0, 1fr); gap: 6px 10px; } }
.inline-link { margin-left: 8px; font-size: 0.88rem; }

/* ======================================================================
   案件の画面：上（番号・状態・よく使うボタン）は残る。中身は2列
   ====================================================================== */
.job-head { margin: 0 0 12px; }
.job-head .title-row { margin-bottom: 0; }
.job-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.job-title .page-title { margin-right: 4px; }
.job-head__notes > .notice { margin: 10px 0 0; }
/* 削除済み・キャンセルの案件の上の灰色の帯（いつ・だれ・理由と、元に戻すボタン） */
.gone-band {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 10px 0 0; padding: 10px 14px;
  background: var(--surface-3); border: 1px solid var(--line-strong); border-radius: var(--radius);
}
.gone-band__text { flex: 1 1 260px; margin: 0; display: flex; gap: 4px 12px; flex-wrap: wrap; align-items: baseline; }
.gone-band__text > span { color: var(--ink-2); overflow-wrap: anywhere; }
.gone-band > .btn { flex: none; }
@media (max-width: 640px) {
  .gone-band > .btn { width: 100%; }
}
.job-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.job-actions__danger { display: flex; gap: 8px; padding-left: 8px; border-left: 1px solid var(--line); }
@media (min-width: 1024px) {
  .job-head {
    position: sticky; top: var(--topbar-h); z-index: 20;
    margin: -20px calc(-1 * var(--main-pad)) 14px; padding: 10px var(--main-pad) 12px;
    background: var(--page-bg); border-bottom: 1px solid var(--line);
  }
}
@media (max-width: 1023px) { .job-actions__danger { padding-left: 0; border-left: 0; } }

/* 1359px までは左右の箱をほどいて上から順に（明細の行のあとに担当分）。900px からは いつ・どこ と 内容 だけ横に並べる */
@media (max-width: 1359px) {
  .job-cols > .col { display: contents; }
  .job-cols .o-1 { order: 1; } .job-cols .o-2 { order: 2; } .job-cols .o-3 { order: 3; } .job-cols .o-4 { order: 4; }
  .job-cols .o-5 { order: 5; } .job-cols .o-6 { order: 6; } .job-cols .o-7 { order: 7; }
}
@media (min-width: 900px) and (max-width: 1359px) {
  .job-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .job-cols > .col > * { grid-column: 1 / -1; }
  .job-cols > .col > .o-1, .job-cols > .col > .o-2 { grid-column: auto; }
}
.job-cols .card + .card { margin-top: 0; }

/* 案件詳細（いつ・どこ・お客様）：カードが広いときだけ、お客様を右に並べる */
.where-card { container-type: inline-size; }
.where-grid { display: grid; gap: 6px 24px; grid-template-columns: minmax(0, 1fr); }
@container (min-width: 600px) { .where-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* 担当分（右の列。担当分ごとのまとまり） */
.share-list { list-style: none; margin: 0; padding: 0; }
.share { padding: 12px 0; border-top: 1px solid var(--line); }
.share:first-child { border-top: 0; padding-top: 2px; }
.share__head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.share__letter { display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-ink); font-weight: 700; font-size: 0.9rem; }
.share__name { font-weight: 700; }
.share__actions { display: flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }
.share .kv { margin-top: 8px; font-size: 0.92rem; }
.time-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: -4px 0; font-variant-numeric: tabular-nums; }
.share__nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.mini { padding: 6px 10px; border-radius: 8px; background: var(--surface-2); min-width: 0; }
.mini__label { display: block; color: var(--ink-2); font-size: 0.75rem; font-weight: 600; }
.mini__num { display: block; font-weight: 700; font-variant-numeric: tabular-nums; }
.mini__sub { display: block; color: var(--ink-2); font-size: 0.75rem; }
.mini__alert { color: var(--alert-ink); font-weight: 700; }
.share-total { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 20px; margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--line-strong); font-weight: 700; font-variant-numeric: tabular-nums; }
.share-total span { color: var(--ink-2); font-weight: 600; font-size: 0.85rem; margin-right: 6px; }

/* 会計 */
.money-sum { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 12px; }
.money-sum--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 0 12px; }
.money-sum--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0 0 12px; }
.money-sum--6 { grid-template-columns: repeat(6, minmax(0, 1fr)); margin: 0 0 12px; }
.money-sum--5 > .money-box, .money-sum--6 > .money-box { background: var(--surface); box-shadow: var(--shadow); }
.money-box__sub { color: var(--ink-2); font-size: 0.78rem; }
@media (max-width: 1100px) { .money-sum--5, .money-sum--6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 600px) { .money-sum--4, .money-sum--5, .money-sum--6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.money-box { display: flex; flex-direction: column; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.money-sum--4 > .money-box { background: var(--surface); box-shadow: var(--shadow); }
.money-box__label { color: var(--ink-2); font-size: 0.8rem; font-weight: 600; }
.money-box__num { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.money-box--alert { background: var(--alert-soft); border-color: var(--alert-line); }
.money-box--alert .money-box__num, .money-box--alert .money-box__label { color: var(--alert-ink); }
.memo-box { margin: 0 0 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.radio-list { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 8px; }

/* 変更の記録（案件の画面の右の列：短い一覧） */
.hist { list-style: none; margin: 0; padding: 0; }
.hist > li { padding: 8px 0; border-top: 1px solid var(--line); font-size: 0.88rem; }
.hist > li:first-child { border-top: 0; padding-top: 0; }
.hist__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.hist__time { color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hist__what { font-weight: 700; }
.hist__who { color: var(--ink-2); }
.hist .audit-change { max-width: none; margin-top: 2px; }
.hist__reason { margin-top: 2px; color: var(--ink-2); }

/* 型番（機械・型番の2つの欄の行） */
.model-field { margin-top: 0; }
.model-rows { display: grid; gap: 6px; margin-bottom: 8px; }
.model-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 40px; gap: 6px; align-items: start; }
.model-row > div > input { width: 100%; }
.model-row--head { color: var(--ink-2); font-size: 0.82rem; font-weight: 600; margin-bottom: 4px; }

/* 欄を並べた箱の中は、上下の間を少し詰める */
.admin-main .grid-2 > .field, .admin-main .grid-3 > .field { margin: 8px 0; }

/* ======================================================================
   新しい案件
   ====================================================================== */
.job-new fieldset { margin: 10px 0; }
.job-new fieldset .field { margin: 6px 0; }
.grid-3--tight { gap: 8px; }
.opt-grid { display: grid; gap: 2px 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.opt-item { display: flex; align-items: center; gap: 8px; }
.opt-item .check { flex: 1 1 auto; min-width: 0; }
.qty-input { width: 4.5em !important; min-height: 36px !important; padding: 4px 8px !important; }
/* 注文：カードが広いときだけ、洗濯機とエアコンを横に並べる */
.order-card { container-type: inline-size; }
.order-grid { display: grid; gap: 0 var(--gap); grid-template-columns: minmax(0, 1fr); }
@container (min-width: 700px) { .order-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); } }
.order-grid > fieldset { margin: 10px 0; }

/* ======================================================================
   空き状況
   ====================================================================== */
.avail-wrap { border: 1px solid var(--line); background: var(--surface); }
.avail { width: 100%; border-collapse: collapse; font-size: 0.85rem; background: var(--surface); }
.avail th, .avail td { border: 1px solid var(--line); padding: 6px; vertical-align: top; min-width: 136px; }
.avail thead th { position: sticky; top: 0; background: var(--surface-2); color: var(--ink-2); font-size: 0.85rem; z-index: 1; }
.avail thead th.is-today { background: var(--primary-soft); color: var(--primary-ink); }
.avail td.is-today { background: #fafaff; }
.avail th.avail__who { position: sticky; left: 0; background: var(--surface); text-align: left; min-width: 120px; width: 140px; z-index: 2; }
.avail thead th.avail__who { background: var(--surface-2); z-index: 3; }
.slot-line { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 6px; padding: 1px 4px; white-space: nowrap; font-size: 0.8rem; border-radius: 4px; } /* 時間帯（8:00〜10:00）の横に入らなければ「あと○時間」は次の行へ */
.slot--open { color: var(--primary-ink); font-weight: 700; }
.slot--blocked { background: var(--surface-3); color: var(--ink-2); }
.slot--closed, .slot--inactive { color: var(--ink-3); }
.day-off { display: block; margin-bottom: 4px; padding: 1px 4px; border: 1px dotted var(--ink-2); background: var(--surface-3); border-radius: 4px; text-align: center; font-weight: 700; font-size: 0.8rem; }
.ev--link { text-decoration: none; }

/* ======================================================================
   写真
   ====================================================================== */
.photo-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.col .photo-grid, .cols .photo-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.photo { margin: 0; font-size: 0.82rem; }
.photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-sm); background: var(--surface-3); border: 1px solid var(--line); }
.photo figcaption { margin-top: 4px; }
.photo-groups { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr); align-items: start; }
.photo-groups > .card + .card { margin-top: 0; }
@media (min-width: 1280px) { .photo-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ======================================================================
   エリア
   ====================================================================== */
.muni-grid { display: grid; gap: 0 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.muni-grid .check { min-height: 34px; }
.prio { list-style: none; margin: 0; padding: 0; counter-reset: prio; }
.prio li { display: flex; gap: 6px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.prio li:last-child { border-bottom: 0; }
.prio li::before {
  counter-increment: prio; content: counter(prio);
  display: inline-grid; place-items: center; width: 24px; height: 24px; flex: 0 0 auto;
  border-radius: 50%; background: var(--primary-soft); color: var(--primary-ink); font-weight: 700; font-size: 0.8rem;
}
.prio__name { flex: 1 1 auto; min-width: 0; }
.area-cols { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr); align-items: start; }
.area-cols > .card + .card { margin-top: 0; }
@media (min-width: 1100px) { .area-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ======================================================================
   変更の記録
   ====================================================================== */
.audit-change { font-size: 0.85rem; line-height: 1.5; max-width: 720px; overflow-wrap: anywhere; }
.audit-change > div { white-space: pre-wrap; }
.audit-val { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.78rem; white-space: pre-wrap; word-break: break-all; max-width: 640px; margin: 4px 0 0; background: var(--surface-2); padding: 6px 8px; border-radius: 6px; }
.audit-table td { min-width: 5em; }

/* ======================================================================
   設定・アカウント・委託先
   ====================================================================== */
.inline-form { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; margin-top: 10px; }
.inline-form .field { margin: 0; }
.key-once { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); }
.account-card { max-width: 560px; }
.account-card + .account-card { margin-top: var(--gap); }
.settings-grid { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr); align-items: start; }
.settings-grid > .card + .card { margin-top: 0; }
.settings-grid > .settings-wide { grid-column: 1 / -1; }
@media (min-width: 1100px) { .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1700px) { .settings-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.settings-grid + .settings-grid, .card + .settings-grid { margin-top: var(--gap); }

/* ======================================================================
   そのほか
   ====================================================================== */
.admin-main .grid-2 + .card, .admin-main .card + .grid-2, .admin-main .grid-2 + .grid-2, .admin-main .grid-2 + section { margin-top: var(--gap); }
.grid-2 > form.card + form.card, .grid-2 > section + form, .grid-2 > form + section { margin-top: 0; }

/* ダイアログ（入力のあるもの）は広め。中は2列に並べる */
dialog.dialog:has(> form.dialog__form) { width: min(600px, calc(100vw - 32px)); max-width: min(600px, calc(100vw - 32px)); }
dialog.dialog.dialog--wide { width: min(920px, calc(100vw - 32px)); max-width: min(920px, calc(100vw - 32px)); }
.dialog__body .grid-2b, .dialog__body .grid-2 { gap: 0 12px; }

@media print {
  .admin-side, .admin-bar, .admin-backdrop, .back-link, .cell-actions, .job-actions, .fbar { display: none !important; }
  .admin-shell { display: block; }
  .job-head { position: static; }
}

/* スマホ幅：表は折り返さずに横へスクロールする（変更の記録の「変更」だけは折り返す） */
@media (max-width: 720px) {
  .admin-main .table th, .admin-main .table td { white-space: nowrap; }
  .admin-main .table td .audit-change, .admin-main .audit-table td:nth-child(5) { white-space: normal; min-width: 220px; }
  .money-box { padding: 8px 10px; }
  .money-box__num { font-size: 1.02rem; white-space: nowrap; }
  .fbar input[type="search"] { width: 100%; }
  .fbar input[type="date"] { width: 8.8em; }
}

/* ======================================================================
   スマホ（640px まで）：緊急のときに使えるように（2026-12-01 持ち主の依頼）
   - 案件の一覧と明細の行は、表をやめて1件ずつ縦に並べる（ほかの表は、表の箱の中だけ横にずらせる）
   - ボタンは押しやすい高さ（44px）・入力の欄は1列・ダイアログは画面の幅いっぱい
   ====================================================================== */
@media (max-width: 640px) {
  .admin-main .btn--small, dialog .btn--small, .admin-side__foot .btn--small { min-height: 44px; padding: 8px 14px; }
  .table td .cell-select { min-height: 44px; }
  .admin-main .grid-2b, .dialog__body .grid-2b { grid-template-columns: minmax(0, 1fr); }
  dialog.dialog, dialog.dialog:has(> form.dialog__form), dialog.dialog.dialog--wide { width: calc(100vw - 16px); max-width: calc(100vw - 16px); }
  dialog { padding: 16px; }

  /* 案件の一覧：1件ずつのカード（時間帯・番号・金額 → お客様・市区町村 → メニュー → 担当 → 印） */
  .jobs-table thead { display: none; }
  .jobs-table, .jobs-table > tbody { display: block; }
  .jobs-table > tbody > tr.date-row { display: block; }
  .jobs-table > tbody > tr.date-row > th { display: block; }
  .jobs-table > tbody > tr:not(.date-row) {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 10px; align-items: baseline;
    padding: 10px 12px; border-bottom: 1px solid var(--line);
  }
  .jobs-table > tbody > tr:not(.date-row) > td { display: block; padding: 0; border: 0; min-width: 0; white-space: normal; }
  .jobs-table .c-time { grid-column: 1; grid-row: 1; }
  .jobs-table .c-no { grid-column: 2; grid-row: 1; }
  .table.jobs-table .c-amt { grid-column: 3; grid-row: 1; text-align: right; }
  .jobs-table .c-cust { grid-column: 1 / 3; grid-row: 2; }
  .jobs-table .c-muni { grid-column: 3; grid-row: 2; text-align: right; }
  .jobs-table .c-menu, .jobs-table .c-share, .jobs-table .c-st { grid-column: 1 / -1; min-width: 0; }
  .jobs-table .c-st:empty { display: none; }

  /* 明細の行：担当分 → 名前と金額 → 単価と数 → 編集・削除 */
  .items-table thead { display: none; }
  .items-table, .items-table > tbody, .items-table > tfoot { display: block; }
  .items-table > tbody > tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 10px 8px; border-bottom: 1px solid var(--line); }
  .items-table > tbody > tr > td { display: block; padding: 0; border: 0; text-align: left; }
  .items-table .i-share { grid-column: 1 / -1; grid-row: 1; }
  .items-table .i-ops { grid-column: 1 / -1; grid-row: 4; }
  .items-table .i-share .cell-select { width: 100%; }
  .items-table .i-name { grid-column: 1; grid-row: 2; font-weight: 600; }
  .table.items-table td.i-amt { grid-column: 2; grid-row: 2; text-align: right; font-weight: 700; }
  .table.items-table td.i-unit, .table.items-table td.i-qty { color: var(--ink-2); font-size: 0.85rem; }
  .table.items-table td.i-unit { grid-column: 1; grid-row: 3; text-align: left; }
  .table.items-table td.i-qty { grid-column: 2; grid-row: 3; text-align: right; }
  .items-table td[data-label]::before { content: attr(data-label) '　'; }
  .items-table > tfoot > tr { display: flex; justify-content: space-between; padding: 10px 8px; }
  .items-table > tfoot > tr > * { display: block; padding: 0; border: 0; background: none; }
  .items-table > tfoot > tr > td:empty { display: none; }
}

/* 到着の時間帯の「時間を指定」：はじめ〜終わり（15分きざみ） */
.time-range { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.time-range[hidden] { display: none; }
.time-range input { flex: 1 1 0; min-width: 0; }


/* ======================================================================
   空き状況：Google カレンダーの週表示の形（2026-12-01 持ち主の依頼）
   縦に時刻（0:00〜24:00。箱の中で縦にずらす。日付と委託先の見出しは上に残る）、横に日付 × 委託先の列
   ====================================================================== */
.wk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 0 12px; }
.wk-bar__range { margin: 0 4px; font-size: 1rem; }
.wk-bar select, .wk-bar input[type="date"] { width: auto; }
.multi { position: relative; }
.multi > summary { list-style: none; cursor: pointer; }
.multi > summary::-webkit-details-marker { display: none; }
.multi__menu { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 240px; max-height: 60vh; overflow: auto; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.multi__menu .btn-row { margin-top: 8px; }
.wk-box { overflow: auto; max-height: calc(100dvh - var(--topbar-h) - 170px); min-height: 360px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.wk-grid { display: grid; position: relative; }
.wk-head1 { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: center; height: 34px; background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: 0.85rem; font-weight: 700; white-space: nowrap; }
.wk-dayhead.is-today { background: var(--primary-soft); color: var(--primary-ink); }
.wk-head2 { position: sticky; top: 34px; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 36px; padding: 2px; overflow: hidden; background: var(--surface); border-bottom: 1px solid var(--line-strong); color: var(--ink-2); font-size: 0.72rem; font-weight: 600; line-height: 1.25; text-align: center; white-space: nowrap; }
.wk-conhead__name { color: var(--ink); }
.wk-head2 > span { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
/* 日表示：日付は左に寄せる（列が多くて横にずれても見えるように） */
.wk-grid--day .wk-dayhead { justify-content: flex-start; padding-left: 12px; }
.wk-corner, .wk-gutter, .wk-gutter-label { position: sticky; left: 0; z-index: 4; background: var(--surface); }
.wk-corner.wk-head1, .wk-corner.wk-head2 { z-index: 6; }
.wk-gutter { height: calc(var(--hour) * 24); border-right: 1px solid var(--line); }
.wk-hour { position: absolute; right: 8px; transform: translateY(-50%); color: var(--ink-3); font-size: 0.7rem; font-variant-numeric: tabular-nums; }
.wk-slot { position: absolute; left: 4px; width: 4px; border-radius: 2px; background: var(--primary-soft-2); }
.wk-col {
  position: relative; height: calc(var(--hour) * 24); border-left: 1px solid var(--line);
  background-image: linear-gradient(to bottom, var(--line) 1px, transparent 1px), linear-gradient(to bottom, #f0f1f6 1px, transparent 1px);
  background-size: 100% var(--hour), 100% var(--hour);
  background-position: 0 0, 0 calc(var(--hour) / 2);
}
.wk-col.is-closed { background-color: var(--surface-3); }
.wk-sep { border-left: 2px solid var(--line-strong); }
.wk-off { position: absolute; left: 0; right: 0; background: rgba(29, 33, 64, 0.035); pointer-events: none; }
.wk-ev {
  position: absolute; z-index: 1; display: flex; flex-direction: column; overflow: hidden; box-sizing: border-box;
  padding: 2px 4px; border-radius: 6px; font-size: 0.72rem; line-height: 1.25; text-decoration: none;
}
a.wk-ev:hover { filter: brightness(0.96); }
.wk-ev--job { background: var(--primary); color: #fff; }
.wk-ev--tentative { background: var(--tentative-soft); border: 1.5px dashed var(--tentative-line); color: var(--tentative-ink); }
.wk-ev--off { background: var(--surface-3); border-left: 3px solid var(--ink-3); color: var(--ink-2); }
.wk-ev--other { background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink); }
/* カレンダーから消えた（動いた）担当分：赤い枠と、案件の画面と同じ赤の印（ブロックの幅いっぱい。週の狭い列では2行に折り返す） */
.wk-ev--lost { padding: 1px 2px; border: 2px solid var(--alert); }
.wk-ev__alert { display: block; flex: none; margin: 0 0 2px; padding: 0; overflow: hidden; border-radius: 4px; font-size: 0.6rem; line-height: 1.35; text-align: center; white-space: normal; }
.wk-ev__alert > span { display: inline-block; white-space: nowrap; }
/* 時間：「8:00」「〜12:00」は1行に入らなければ2行に折れる（それぞれの中では折らない） */
.wk-ev__time { display: flex; flex-wrap: wrap; font-weight: 700; white-space: nowrap; }
.wk-ev__what, .wk-ev__no { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-ev__no { opacity: 0.8; }
.wk-now { position: absolute; left: 0; right: 0; z-index: 2; height: 2px; background: var(--alert); pointer-events: none; }
.wk-now--first::before { content: ''; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--alert); }
.wk-gutter-label { display: flex; align-items: center; justify-content: flex-end; padding-right: 6px; border-bottom: 1px solid var(--line-strong); color: var(--ink-3); font-size: 0.7rem; }
.wk-allday { display: flex; flex-direction: column; gap: 2px; min-height: 22px; padding: 2px; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line-strong); }
.wk-chip { display: block; padding: 1px 4px; overflow: hidden; border-radius: 4px; font-size: 0.7rem; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) {
  .wk-box { max-height: calc(100dvh - var(--topbar-h) - 230px); }
  /* 委託先の絞り込みのメニューは、上の帯の幅いっぱいに出す（右にはみ出さない） */
  .wk-bar { position: relative; }
  .wk-bar .multi { position: static; }
  .wk-bar .multi__menu { left: 0; right: 0; min-width: 0; }
}

/* 写真の画面：案件ごとのカードの右上（ブログの印と一括ダウンロード） */
.photo-group__ops { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }

/* 新しい案件の担当：担当ごとのカード（委託先・受け持つメニューの台数・作業時間）と、「担当を追加」「自動で割り当て」 */
.share-picks { display: grid; gap: 10px; }
.share-pick { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: var(--surface); }
.share-pick__head { display: flex; align-items: center; gap: 8px; }
.share-pick__head select { flex: 1 1 auto; min-width: 0; }
.share-pick__rows { display: grid; gap: 6px; margin-top: 8px; }
.share-pick__row { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.share-pick__name { flex: 1 1 160px; min-width: 0; font-size: 0.9rem; overflow-wrap: anywhere; }
.share-pick__qty { display: inline-flex; align-items: center; gap: 6px; }
.share-pick__of { color: var(--ink-2); font-size: 0.85rem; min-width: 2.4em; font-variant-numeric: tabular-nums; }
.share-pick__time { margin-top: 8px; font-size: 0.85rem; color: var(--ink-2); }
.stepper { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line-strong); border-radius: var(--radius-pill); padding: 2px; background: var(--surface); }
.stepper__btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--primary-ink); cursor: pointer;
}
.stepper__btn svg { width: 18px; height: 18px; }
.stepper__btn:hover { background: var(--primary-soft); }
.stepper__btn:disabled { color: var(--ink-3); background: transparent; cursor: not-allowed; }
/* 台数の欄は −/＋ の枠の中の数（共通の入力欄の枠・高さは付けない） */
.stepper input[type="number"].stepper__in {
  width: 3em; height: 34px; min-height: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; background: transparent; text-align: center;
  font: inherit; font-weight: 700; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield;
}
.stepper input[type="number"].stepper__in:focus { box-shadow: var(--ring); border-radius: var(--radius-sm); }
.share-pick__head > .btn { flex: none; white-space: nowrap; }
.stepper__in::-webkit-outer-spin-button, .stepper__in::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.assign-cell { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: center; font-size: 0.85rem; }
.assign-cell .badge { margin: 0; }
@media (max-width: 640px) {
  .stepper__btn { width: 44px; height: 44px; }
  .stepper input[type="number"].stepper__in { height: 44px; }
}

/* 送れなかったメールの送り直しの結果（送れなかった） */
.resend-ng { color: var(--alert-ink); font-weight: 700; }
