/* ============================================================
   ZIOBIT WEBシステムツール - スタイル
   （StaffBoardのデザイン言語を踏襲・テーマ色は設定で変更可能）
============================================================ */
:root {
  --theme: #0f766e;
  --theme-dark: #0d5f59;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --danger: #dc2626;
  --warn: #d97706;
  --ok: #16a34a;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 16px rgba(15, 23, 42, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "BIZ UDPGothic", Meiryo, system-ui, sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 15px; line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
.hidden { display: none !important; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 16px; }

/* ============ ログイン ============ */
.login-wrap {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: linear-gradient(160deg, var(--theme) 0%, var(--theme-dark) 60%, #083f3b 100%);
}
.login-box {
  width: 100%; max-width: 400px; background: var(--card);
  border-radius: 16px; box-shadow: 0 8px 40px rgba(0,0,0,.25); overflow: hidden;
}
.login-head { text-align: center; padding: 28px 24px 8px; }
.login-head .sys-logo { width: 64px; height: 64px; border-radius: 14px; }
.login-head h1 { font-size: 19px; margin: 12px 0 2px; }
.login-head .sub { color: var(--muted); font-size: 13px; }
.login-body { padding: 20px 28px 30px; }
.login-error {
  display: none; background: #fef2f2; color: var(--danger);
  border: 1px solid #fecaca; border-radius: 8px;
  padding: 9px 12px; font-size: 13px; margin-bottom: 14px;
}

/* ============ ヘッダー・ナビ ============ */
.header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--theme); color: #fff; padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; min-width: 0; }
.brand img { width: 28px; height: 28px; border-radius: 6px; background: #fff; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.user-chip {
  background: rgba(255,255,255,.16); border-radius: 999px;
  padding: 4px 12px; font-size: 13px; max-width: 180px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.admin-mark { color: #fbbf24; margin-right: 4px; }
.icon-btn {
  background: none; border: none; color: #fff; font-size: 17px;
  padding: 8px 10px; cursor: pointer; border-radius: 8px;
}
.icon-btn:hover { background: rgba(255,255,255,.15); }

.nav {
  display: flex; gap: 2px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 0 8px; position: sticky; top: 48px; z-index: 40;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav button {
  display: flex; align-items: center; gap: 6px;
  background: none; border: none; border-bottom: 3px solid transparent;
  color: var(--muted); padding: 12px 13px 9px; font-size: 13.5px;
  cursor: pointer; white-space: nowrap;
}
.nav button.active { color: var(--theme); border-bottom-color: var(--theme); font-weight: 700; }
.nav button:hover { color: var(--theme); }
body:not(.admin-mode) .admin-only { display: none !important; }

.main { max-width: 1180px; margin: 0 auto; padding: 18px 20px 60px; }
/* スタッフ管理画面のみ全幅レイアウト（一覧を広く使うため） */
body.wide-view .main { max-width: 100%; }

/* ============ 共通部品 ============ */
h2.page-title { font-size: 18px; margin: 4px 0 14px; display: flex; align-items: center; gap: 9px; }
h2.page-title i { color: var(--theme); }
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px;
}
.card h3 { font-size: 15px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.card h3 i { color: var(--theme); }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--theme); color: #fff; border: none;
  border-radius: 9px; padding: 9px 16px; font-size: 14px;
  cursor: pointer; font-weight: 600;
}
.btn:hover { background: var(--theme-dark); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-block { width: 100%; justify-content: center; padding: 12px; }
.btn-ghost { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn-ghost:hover { background: #f8fafc; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }

.form-row { margin-bottom: 13px; }
.form-label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 5px; }
.form-control {
  width: 100%; border: 1px solid #cbd5e1; border-radius: 9px;
  padding: 9px 12px; background: #fff;
}
.form-control:focus { outline: 2px solid var(--theme); outline-offset: 0; border-color: var(--theme); }
.form-hint { font-size: 12px; color: var(--muted); }
.login-remember { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #4a5568; margin: 2px 0 4px; cursor: pointer; user-select: none; }
.login-remember input { width: 16px; height: 16px; cursor: pointer; }
.form-hint.login-warn { margin: 0 0 12px; font-size: 13px; color: #4a5568; }
.form-hint.login-help { text-align: center; margin-top: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar .form-control { width: auto; flex: 1; min-width: 140px; }

/* テーブル（PC）→ カード（スマホ） */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.list th {
  text-align: left; background: #f8fafc; color: var(--muted);
  font-size: 12px; padding: 8px 10px; border-bottom: 2px solid var(--line); white-space: nowrap;
}
table.list td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:hover td { background: #f8fafc; }

/* スタッフ一覧: 枠（フレーム）を固定し、一覧はその中で縦横スクロールする
   縦: 画面の約6割で固定 ／ 横: 枠内でスクロール（ページ全体は広がらない） */
#viewStaff .card { overflow: hidden; }             /* カードからはみ出させない */
#viewStaff .table-wrap {
  max-height: 62vh; overflow: auto;              /* 縦横ともに枠内スクロール */
  width: 100%; max-width: 100%;
  border: 1px solid var(--line); border-radius: 9px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
#viewStaff table.list {
  width: max-content;                             /* 内容ぶんの幅・枠を超えたら枠内で横スクロール */
  min-width: 100%;                                /* 内容が少ないときは枠いっぱい */
}
#viewStaff table.list thead th {
  position: sticky; top: 0; z-index: 2;           /* 見出し行は縦スクロールしても上部に固定 */
  background: #f8fafc; box-shadow: 0 1px 0 var(--line);
}
@media (max-width: 640px) {
  #viewStaff .table-wrap { max-height: 70vh; }
}

.badge {
  display: inline-block; border-radius: 999px; font-size: 11.5px;
  padding: 2px 10px; font-weight: 700; white-space: nowrap;
}
.badge-admin { background: #fef3c7; color: #92400e; }
.badge-staff2 { background: #e0f2fe; color: #075985; }
.badge-active { background: #dcfce7; color: #166534; }
.badge-suspended { background: #fee2e2; color: #991b1b; }
.badge-deleted { background: #f1f5f9; color: #64748b; }
.badge-on { background: #dcfce7; color: #166534; }
.badge-off { background: #f1f5f9; color: #64748b; }

/* ============ ホーム: システムタイル（業務イラスト・統一カード） ============ */
/* ★2026-09-23 タイルを小さくした（宮本さんの依頼）。1行5枚 → 7枚。絵も一回り小さく */
.tiles {
  --tile-gap: 14px; --ill-size: 64px; --ill-svg: 42px; --card-h: 138px;
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: var(--tile-gap); justify-content: center;
  max-width: 1200px; margin: 0 auto;
}
.tile {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  height: var(--card-h);
  text-decoration: none; color: var(--text);
  background: var(--card); border: 1px solid #edf0f4; border-radius: 14px;
  box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 6px 16px rgba(16,24,40,.05);
  padding: 16px 8px 12px; text-align: center;
  transition: transform .16s ease, box-shadow .16s ease;
}
/* カード上部の機能別アクセントライン（色は --accent = 各システムの色） */
.tile::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: var(--accent, var(--theme)); border-radius: 16px 16px 0 0;
}
.tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 10px rgba(16,24,40,.08), 0 18px 34px rgba(16,24,40,.11);
}
/* イラスト表示領域（背景円・SVGサイズを全カードで統一） */
.tile .t-ill {
  width: var(--ill-size); height: var(--ill-size); border-radius: 50%;
  background: #f1f4f8; display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.tile .t-ill-svg { width: var(--ill-svg); height: var(--ill-svg); display: block; }
.tile .t-name { margin-top: 10px; font-weight: 700; font-size: 13px; line-height: 1.3; letter-spacing: .01em; color: var(--text); }
.tile .t-note { margin-top: 3px; font-size: 10px; color: var(--muted); line-height: 1.35; font-weight: 500; max-width: 96%; }
.empty-note { color: var(--muted); text-align: center; padding: 30px 10px; }
@media (max-width: 1160px) { .tiles { grid-template-columns: repeat(6, 1fr); } }
@media (max-width: 900px)  { .tiles { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 640px)  { .tiles { grid-template-columns: repeat(3, 1fr); } }

/* ============ ホーム: 本人の数字帯（タイルの上・横1列の細い帯） ============ */
/* ★2026-09-23 追加。タイルと同じ丸み・影・余白の作法にそろえる。タイルの大きさは変えない */
.dash { max-width: 1200px; margin: 0 auto 14px; }
.dash-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.dash-card {
  display: flex; align-items: center; gap: 9px; width: 100%; height: 68px;
  padding: 9px 11px; text-align: left; font: inherit; color: var(--text);
  background: var(--card); border: 1px solid #edf0f4; border-radius: 14px;
  box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 6px 16px rgba(16,24,40,.05);
  cursor: pointer; transition: transform .16s ease, box-shadow .16s ease;
}
.dash-card:hover:not([disabled]) {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(16,24,40,.08), 0 14px 26px rgba(16,24,40,.10);
}
/* 使えないシステム・読み込み中は押せない見た目にする */
.dash-card[disabled] { cursor: default; opacity: .6; }
.dash-card .d-ico {
  width: 26px; height: 26px; border-radius: 50%; background: #f1f4f8; color: var(--theme);
  display: flex; align-items: center; justify-content: center; font-size: 12px; flex: 0 0 auto;
}
.dash-card .d-body { flex: 1 1 auto; min-width: 0; }
.dash-card .d-label {
  display: block; font-size: 10px; font-weight: 600; color: var(--muted); line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dash-card .d-val {
  display: block; font-size: 19px; font-weight: 800; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: clip;   /* 長い金額でも枠を壊さない */
}
.dash-card .d-val .d-pre { font-size: 10px; font-weight: 700; color: var(--muted); margin-right: 4px; }
.dash-card .d-val .d-unit { font-size: 10px; font-weight: 700; color: var(--muted); margin-left: 2px; }
.dash-card .d-sub {
  display: block; font-size: 10px; color: var(--muted); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dash-card .d-bad { color: var(--danger); font-weight: 700; }
/* 2日以上古い写しの数字は色を落とす */
.dash-card.is-stale .d-val { color: var(--muted); }
/* 「いつ時点か」（帯の右端） */
.dash-at { margin-top: 5px; text-align: right; font-size: 10px; color: var(--muted); }
.dash-at.is-stale { color: #94a3b8; }
.dash-at i { margin-right: 3px; }
/* 読み込み中の薄い灰色の枠 */
.dash-card.is-load .d-ico { background: #eef1f5; color: transparent; }
.dash-sk { display: block; background: #eef1f5; border-radius: 5px; }
.dash-sk.sk-a { width: 62%; height: 8px; margin-bottom: 6px; }
.dash-sk.sk-b { width: 44%; height: 20px; margin-bottom: 6px; }
.dash-sk.sk-c { width: 74%; height: 8px; }
/* 画面が狭いときは 2列×5段に折り返す（★2026-09-23 9枚に増やしたため） */
@media (max-width: 860px) {
  .dash-row { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .dash-card:hover:not([disabled]) { transform: none; }
}

/* ============ モーダル ============ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 100;
  display: none; align-items: flex-start; justify-content: center;
  padding: 4vh 14px; overflow-y: auto;
  overscroll-behavior: contain;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 480px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3); overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; gap: 9px;
  background: var(--theme); color: #fff; padding: 13px 18px; font-weight: 700;
}
.modal-body { padding: 18px; max-height: 68vh; overflow-y: auto; overscroll-behavior: contain; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 13px 18px; border-top: 1px solid var(--line); background: #f8fafc;
}
.confirm-text { font-size: 14.5px; }
.confirm-target {
  background: #f8fafc; border: 1px solid var(--line); border-radius: 9px;
  padding: 10px 14px; margin: 12px 0; font-size: 14px;
}

/* チェックボックス群 */
.check-row { display: flex; align-items: center; gap: 9px; padding: 6px 0; font-size: 14px; }
.check-row input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--theme); }

/* トグルスイッチ */
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.switch-row:last-child { border-bottom: none; }
.switch-label { font-size: 14.5px; font-weight: 700; }
.switch-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }
.switch { position: relative; width: 48px; height: 28px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px;
  cursor: pointer; transition: background-color .2s;
}
.switch .slider::before {
  content: ""; position: absolute; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch input:checked + .slider { background: var(--ok); }
.switch input:checked + .slider::before { transform: translateX(20px); }
.switch input:focus-visible + .slider { outline: 2px solid #2563eb; outline-offset: 2px; }

/* ============ QRコード ============ */
.qr-area { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 10px 0; }
.qr-box { background: #fff; padding: 16px; border: 1px solid var(--line); border-radius: 12px; }
.qr-box img, .qr-box canvas { display: block; width: 220px !important; height: 220px !important; image-rendering: pixelated; }
.qr-url { font-size: 13px; color: var(--muted); word-break: break-all; text-align: center; }

/* ============ 操作履歴 ============ */
.audit-item { border-bottom: 1px solid var(--line); padding: 9px 2px; font-size: 13px; }
.audit-item .a-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.audit-item .a-action { font-weight: 700; color: var(--theme); }
.audit-item .a-date { color: var(--muted); font-size: 12px; }
.audit-item .a-detail { color: var(--text); margin-top: 2px; word-break: break-all; }
.audit-item .a-meta { color: var(--muted); font-size: 11.5px; }

/* ============ トースト ============ */
.toast {
  position: fixed; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: #1e293b; color: #fff; border-radius: 10px;
  padding: 11px 20px; font-size: 14px; opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s; z-index: 3000; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 3001; background: #0f766e; color: #fff; padding: 10px 16px; border-radius: 8px; font-weight: 700; text-decoration: none; }
.skip-link:focus { top: 8px; }

/* ============ スマホ調整 ============ */
@media (max-width: 640px) {
  .main { padding: 14px 10px 70px; }
  .card { padding: 14px; }
  .nav { top: 47px; }
  .nav button span { font-size: 12.5px; }
  table.list { font-size: 12.5px; }
  table.list th, table.list td { padding: 7px 6px; }
  .hide-sp { display: none; }
  .tiles { grid-template-columns: repeat(3, 1fr); gap: 10px; --ill-size: 56px; --ill-svg: 36px; --card-h: 124px; }
}
@media print {
  .header, .nav, .toolbar, .btn { display: none !important; }
}

/* ============================================================
   ★2026-09-23 ホームの見た目を作り直した（宮本さんの依頼
   「もう少し見やすく・お洒落でインパクトのあるデザインに」）
   動き・中身は何も変えていない。見た目（色・大きさ・影）だけ。
   ここを丸ごと消せば、元の見た目に戻る。
   ============================================================ */

/* 背景に、うっすら色の広がりを置く（真っ平らな灰色をやめる） */
body {
  background:
    radial-gradient(900px 420px at 12% -8%, rgba(15,118,110,.10), transparent 60%),
    radial-gradient(760px 380px at 96% 4%, rgba(59,130,246,.09), transparent 62%),
    linear-gradient(180deg, #f6f9fb 0%, #eef2f7 100%);
}

/* 上の帯（ヘッダー）を深い緑の濃淡に */
.header {
  background: linear-gradient(100deg, #0f766e 0%, #0d5f59 55%, #0b4f4a 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,.08) inset, 0 6px 18px rgba(4,47,44,.18);
}
.brand img { box-shadow: 0 2px 6px rgba(0,0,0,.18); }

/* ---- 数字帯（ダッシュボード）: 系統ごとに色を持たせる ---- */
.dash-row { gap: 12px; }
.dash-card {
  height: 74px; padding: 9px 12px; gap: 10px;
  border: 1px solid rgba(16,24,40,.06); border-radius: 16px;
  background: linear-gradient(180deg, #fff 0%, #fdfefe 100%);
  box-shadow: 0 1px 2px rgba(16,24,40,.05), 0 8px 20px rgba(16,24,40,.06);
  position: relative; overflow: hidden;
}
.dash-card::before {                /* 上のふちの色 */
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, var(--c, var(--theme)), color-mix(in srgb, var(--c, var(--theme)) 35%, #fff));
}
.dash-card:hover:not([disabled]) {
  transform: translateY(-3px);
  box-shadow: 0 6px 14px rgba(16,24,40,.09), 0 18px 34px rgba(16,24,40,.13);
  border-color: color-mix(in srgb, var(--c, var(--theme)) 30%, #e8edf3);
}
.dash-card .d-ico {
  width: 34px; height: 34px; border-radius: 12px; font-size: 14px;
  background: #eef2f7;
  background: color-mix(in srgb, var(--c, var(--theme)) 13%, #fff);
  color: var(--c, var(--theme));
}
.dash-card .d-label { font-size: 10.5px; font-weight: 700; letter-spacing: .02em; color: #7a8698; }
.dash-card .d-val {
  font-size: 26px; font-weight: 800; line-height: 1.12; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; color: #16243a;
}
.dash-card .d-val .d-unit { font-size: 10.5px; margin-left: 3px; color: #8a94a6; }
.dash-card .d-sub { font-size: 10.5px; color: #8a94a6; }
.dash-card[data-k="popeye"]       { --c: #2563eb; }
.dash-card[data-k="sales_amount"] { --c: #16a34a; }
.dash-card[data-k="sales_count"]  { --c: #65a30d; }
.dash-card[data-k="insta"]        { --c: #db2777; }
.dash-card[data-k="kintai"]       { --c: #7c3aed; }
.dash-card[data-k="kyuka"]        { --c: #0891b2; }
.dash-card[data-k="kaiko"]        { --c: #e11d48; }
.dash-card[data-k="bento"]        { --c: #ea8a08; }
.dash-card[data-k="weather"]      { --c: #0284c7; }
.dash-card[data-k="buyer"]        { --c: #b45309; }
.dash-card[disabled] { opacity: .5; }
/* 金額は桁が多いので、この枠だけ数字を少し小さくする */
.dash-card[data-k="sales_amount"] .d-val { font-size: 22px; }
/* バイヤーだけは大きい字が数字でなく英字（AssistantBuyer で 14 文字）。枠からはみ出さない大きさにする */
.dash-card[data-k="buyer"] .d-val {
  font-size: 15px; letter-spacing: 0; font-variant-numeric: normal; white-space: nowrap;
}
/* 押しても開かない枠（天気・販売実績）: 薄くしない。動かない代わりに専用の落ち着いた地色にする */
.dash-card.is-plain {
  cursor: default; opacity: 1;
  background: linear-gradient(180deg, #fff 0%, color-mix(in srgb, var(--c, var(--theme)) 5%, #fff) 100%);
}
.dash-card.is-plain:hover { transform: none; box-shadow: 0 1px 2px rgba(16,24,40,.05), 0 8px 20px rgba(16,24,40,.06); }
/* 天気だけは「押す所ではない」と分かるように、右上に小さなしるしを置く */
.dash-card[data-k="weather"]::after {
  content: ""; position: absolute; right: 10px; top: 10px; width: 6px; height: 6px;
  border-radius: 50%; background: color-mix(in srgb, var(--c) 45%, #fff);
}
.dash-at { font-size: 10.5px; color: #93a0b2; margin-top: 5px; }

/* ---- タイル: 小ささはそのままに、色と陰影を効かせる ---- */
.tile {
  border: 1px solid rgba(16,24,40,.06); border-radius: 16px;
  background: linear-gradient(180deg, #fff 0%, #fcfdfe 100%);
  box-shadow: 0 1px 2px rgba(16,24,40,.05), 0 8px 18px rgba(16,24,40,.06);
}
.tile::before {
  height: 3px; border-radius: 16px 16px 0 0;
  background: linear-gradient(90deg, var(--accent, var(--theme)), color-mix(in srgb, var(--accent, var(--theme)) 30%, #fff));
}
.tile .t-ill {
  border-radius: 18px;                     /* 丸 → 角の丸い四角に */
  background: #f2f5f9;
  background: color-mix(in srgb, var(--accent, var(--theme)) 11%, #fff);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent, var(--theme)) 16%, #fff);
  transition: transform .16s ease;
}
.tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 14px rgba(16,24,40,.10), 0 20px 36px rgba(16,24,40,.13);
  border-color: color-mix(in srgb, var(--accent, var(--theme)) 28%, #e8edf3);
}
.tile:hover .t-ill { transform: scale(1.06); }
.tile .t-name { font-size: 13px; letter-spacing: .01em; color: #1b2a41; }

/* 狭い画面 */
@media (max-width: 860px) {
  .dash-card { height: 74px; }
  .dash-card .d-val { font-size: 23px; }
  .dash-card[data-k="sales_amount"] .d-val { font-size: 19px; }
  .dash-card[data-k="buyer"] .d-val { font-size: 14px; }
}
/* 1段に5枚入る幅のうち、窮屈な所（〜1100px）だけ文字としるしを少し小さくする */
@media (min-width: 861px) and (max-width: 1100px) {
  .dash-row { gap: 8px; }
  .dash-card { padding: 9px 9px; gap: 8px; }
  .dash-card .d-ico { width: 30px; height: 30px; border-radius: 10px; font-size: 13px; }
  .dash-card .d-val { font-size: 21px; }
  .dash-card[data-k="sales_amount"] .d-val { font-size: 17px; }
  .dash-card[data-k="buyer"] .d-val { font-size: 13px; }
  .dash-card .d-sub { font-size: 10px; }
}

/* ★2026-09-24 バイヤーの階級（AssistantBuyer）が、幅 900・390 の枠で最後の字が切れていた。
   枠の幅に合わせて字を小さくする（container の幅の単位 cqi を使う。使えないブラウザは今までの大きさのまま） */
.dash-card[data-k="buyer"] .d-body { container-type: inline-size; }
.dash-card[data-k="buyer"] .d-val { font-size: min(15px, 11.4cqi); }
@media (max-width: 860px) { .dash-card[data-k="buyer"] .d-val { font-size: min(14px, 11.4cqi); } }
@media (min-width: 861px) and (max-width: 1100px) { .dash-card[data-k="buyer"] .d-val { font-size: min(13px, 11.4cqi); } }

/* ---- タイルの並べ替え（管理者だけ。★2026-09-23） ---- */
.tiles-bar {
  max-width: 1200px; margin: 0 auto 8px; display: flex; align-items: center;
  justify-content: flex-end; gap: 10px; flex-wrap: wrap;
}
.tiles-bar.is-sorting { justify-content: space-between; }
.tiles-hint { font-size: 12px; color: var(--muted); }
.tiles-hint i { margin-right: 5px; color: var(--theme); }
.tiles-btns { display: flex; gap: 8px; }
/* 並べ替え中のタイル: つかめることが分かる見た目にする */
.tiles.is-sorting .tile { cursor: grab; user-select: none; }
.tiles.is-sorting .tile:active { cursor: grabbing; }
.tiles.is-sorting .tile::after {
  content: "\f0b2";                        /* 四方向の矢印 */
  font-family: "Font Awesome 6 Free"; font-weight: 900;
  position: absolute; right: 7px; top: 6px; font-size: 10px; color: #b6c2d2;
}
.tiles.is-sorting .tile {
  outline: 2px dashed #cbd5e1; outline-offset: -3px;
}
.tiles.is-sorting .tile:hover { transform: none; }
.tiles.is-sorting .tile.is-drag { opacity: .45; outline-color: var(--theme); }

/* ---- 大きい数がはみ出さないようにする（★2026-09-23 d-fit-guard） ----
   枠の広さ（d-body）に合わせて字の大きさを決める。桁の多い金額でも枠を壊さない。
   cqw を知らない古い画面では、この行ごと無視されて上の決め打ちの大きさのまま動く。 */
.dash-card .d-body { container-type: inline-size; }
.dash-card .d-val                        { font-size: min(26px, 24cqw); }
.dash-card[data-k="sales_amount"] .d-val { font-size: min(20px, 13cqw); }
.dash-card[data-k="sales_count"]  .d-val { font-size: min(26px, 22cqw); }
.dash-card[data-k="weather"]      .d-val { font-size: min(26px, 20cqw); }
/* とても狭い画面では小さい字も少し詰める */
@media (max-width: 400px) {
  .dash-card .d-sub, .dash-card .d-label { font-size: 9.5px; }
}
/* ★2026-09-24 夜 管理者には数の無い枠も出す（「—」）。バイヤー・販売金額・天気は字の大きさを変えてあるので、
   「—」だけ小さくなり、見出しが同じ段のほかの枠より下にずれていた。「—」はどの枠も同じ大きさ・同じ高さにそろえる
   （数や階級の字が入るときは今までどおりの大きさ） */
.dash-card[data-k] .d-val.is-none { font-size: min(26px, 24cqw); letter-spacing: -.02em; }

/* ---- タイルの字がはみ出さないようにする（★2026-09-23 全部の幅） ----
   高さの決め打ち（height）だと、名前が2行＋補足が2行のタイル（例: 監視ダッシュボード）で字が枠の下へはみ出していた。
   「最低の高さ」（min-height）にして、中身が多いときだけ枠が伸びるようにする（ふつうのタイルの見た目は変わらない。
   同じ段のタイルは、いちばん高いタイルにそろう）。長い英字の名前は枠の中で折り返す。補足は2行まで（残りは…） */
.tile { height: auto; min-height: var(--card-h); min-width: 0; }
.tile .t-name { max-width: 100%; overflow-wrap: anywhere; }
.tile .t-note {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
  overflow: hidden; overflow-wrap: anywhere;
}

/* ---- スマホ幅のタイル（★2026-09-23） ----
   幅 640px 以下で、補足の字がタイルの下へはみ出し、下の案内文と重なっていた。
   高さの決め打ち（height）を「最低の高さ」（min-height）に変え、名前が3行になっても枠が伸びるようにする。
   補足は1行に収め、入りきらない分は「…」で省く（641px 以上は上の「全部の幅」の決まりで2行まで）。
   min-width: 0 … 1行の補足の長さで列の幅が広がらないように（3列の幅をそろえたままにする） */
@media (max-width: 640px) {
  .tile { height: auto; min-height: var(--card-h); min-width: 0; }
  .tile .t-note {
    display: block; width: 100%; max-width: 100%;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
}

/* ---- ログアウトのボタン（★2026-09-23 席を立つときに分かりやすく） ----
   アイコンだけだったのを、字でも「ログアウト」と出す。上の帯の高さは変えない（下のメニューの位置がずれないように）。
   スマホ幅では名前の枠と余白を少し詰めて、1行に収める */
.logout-btn {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  background: rgba(255,255,255,.14); color: #fff;
  border: 1px solid rgba(255,255,255,.5); border-radius: 999px;
  padding: 5px 14px 5px 12px; font-size: 13px; font-weight: 700; line-height: 1.3;
  cursor: pointer; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease;
}
.logout-btn i { font-size: 14px; }
.logout-btn:hover { background: rgba(255,255,255,.26); border-color: #fff; }
.logout-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.logout-btn:disabled { opacity: .6; cursor: default; }
@media (max-width: 480px) {
  .header { padding-left: 12px; padding-right: 12px; }
  .header-right { gap: 4px; }
  .user-chip { max-width: 104px; padding: 4px 9px; font-size: 12px; }
  .icon-btn { padding: 8px 7px; }
  .logout-btn { padding: 5px 10px 5px 9px; font-size: 12px; gap: 5px; }
  .logout-btn i { font-size: 13px; }
}
