/* ELC Transfer Web 画面
 * 色: 中間色 + アクセント 1 色(コバルト)。状態の色(照合済み・注意・問題)は意味のあるところだけに使う。
 * 角: 入力とボタン 8px / 枠(パネル・ダイアログ)12px / 札(ピル)は丸。
 * 文字: OS の和文フォント。数字は等幅数字(tabular-nums)、指紋(SHA-256)は等幅。 */

:root {
  color-scheme: light dark;
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --ink: #15181c;
  --ink-2: #353c44;
  --muted: #5b646e;
  --line: #dadee4;
  --line-2: #eaedf1;
  --acc: #2b59c3;
  --acc-ink: #1f4596;
  --acc-soft: #e8eefb;
  --on-acc: #ffffff;
  --ok: #1d7549;
  --ok-soft: #e2f2e9;
  --warn: #8f5b00;
  --warn-soft: #fbf0da;
  --bad: #b3261e;
  --bad-soft: #fbe7e5;
  --shadow: 0 1px 2px rgb(21 24 28 / .05), 0 10px 30px rgb(21 24 28 / .08);
  --r-control: 8px;
  --r-panel: 12px;
  --r-pill: 999px;
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1115;
    --surface: #161a20;
    --surface-2: #1b2027;
    --ink: #e8ebef;
    --ink-2: #c4cad1;
    --muted: #99a2ac;
    --line: #2a3139;
    --line-2: #222830;
    --acc: #7ea3ff;
    --acc-ink: #a8c0ff;
    --acc-soft: #1b2640;
    --on-acc: #0e1115;
    --ok: #5cc58f;
    --ok-soft: #14281d;
    --warn: #e3ae4e;
    --warn-soft: #2c2413;
    --bad: #f07d73;
    --bad-soft: #321a18;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 10px 30px rgb(0 0 0 / .35);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "palt" 0;
}
a { color: var(--acc-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

svg.i { width: 18px; height: 18px; flex: 0 0 auto; vertical-align: -3px; }
svg.i.lg { width: 22px; height: 22px; }
svg.i.xl { width: 40px; height: 40px; }

/* ---- 枠組み ---- */
.top {
  position: sticky; top: 0; z-index: 20;
  height: 60px;
  display: flex; align-items: center; gap: 20px;
  padding: 0 clamp(12px, 3vw, 28px);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .01em; color: var(--ink); white-space: nowrap; }
.brand svg.i { color: var(--acc); width: 22px; height: 22px; }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.nav a {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: var(--r-control);
  color: var(--muted); white-space: nowrap; text-decoration: none;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--acc-soft); color: var(--acc-ink); font-weight: 600; }
.top .spacer { flex: 1; }
.who { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; white-space: nowrap; }
@media (max-width: 760px) {
  .who .email { display: none; }
  .nav a span { display: none; }
  .brand span { display: none; }
}

main.page { max-width: 1320px; margin: 0 auto; padding: 22px clamp(12px, 3vw, 28px) 80px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; min-height: 36px; }
.page-head h1 { font-size: 20px; margin: 0; font-weight: 700; letter-spacing: .01em; }
.page-head .spacer { flex: 1; }
h2.sec { font-size: 15px; margin: 30px 0 10px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
h2.sec:first-child { margin-top: 0; }
p.lead { color: var(--muted); margin: -8px 0 16px; max-width: 72ch; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); }
.panel.pad { padding: 16px 18px; }

/* ---- ボタン・入力 ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px;
  border-radius: var(--r-control); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
  cursor: pointer; white-space: nowrap; font-weight: 500;
  transition: background .15s var(--ease), border-color .15s var(--ease), transform .08s var(--ease);
}
.btn:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--line) 60%, var(--muted)); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--acc); border-color: var(--acc); color: var(--on-acc); }
.btn.primary:hover { background: color-mix(in srgb, var(--acc) 88%, var(--ink)); }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.icon { width: 34px; padding: 0; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.sm.icon { width: 28px; }

.field { display: grid; gap: 6px; margin-bottom: 14px; align-content: start; }
.field label { font-weight: 600; font-size: 13px; }
.field .help { color: var(--muted); font-size: 12.5px; }
.field .err { color: var(--bad); font-size: 12.5px; }
.input, .select {
  height: 36px; padding: 0 11px; width: 100%;
  border: 1px solid var(--line); border-radius: var(--r-control);
  background: var(--surface); color: var(--ink);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.input::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
.input:focus, .select:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--acc) 25%, transparent); }
.select.inline { width: auto; height: 34px; }
.check { width: 16px; height: 16px; accent-color: var(--acc); cursor: pointer; margin: 0; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }

/* ---- 札 ---- */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px; border-radius: var(--r-pill); font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; border: 1px solid var(--line-2); }
.pill svg.i { width: 14px; height: 14px; }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.acc { background: var(--acc-soft); color: var(--acc-ink); border-color: transparent; }

/* ---- パンくず・道具の列 ---- */
.crumbs { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; font-size: 15px; min-width: 0; }
.crumbs a, .crumbs span { padding: 3px 6px; border-radius: 6px; color: var(--ink-2); white-space: nowrap; max-width: 36ch; overflow: hidden; text-overflow: ellipsis; }
.crumbs a:hover { background: var(--surface-2); text-decoration: none; }
.crumbs .cur { font-weight: 700; color: var(--ink); }
.crumbs svg.i { color: var(--muted); width: 16px; height: 16px; }

.toolbar {
  position: sticky; top: 60px; z-index: 10;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 0; margin-bottom: 4px;
  background: var(--bg);
}
.toolbar .count { font-weight: 600; margin-right: 4px; }
.toolbar .spacer { flex: 1; }
.selbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 8px 6px 12px; background: var(--acc-soft); border-radius: var(--r-control); color: var(--acc-ink); }
.selbar .btn { background: var(--surface); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-control); overflow: hidden; }
.seg button { height: 32px; width: 36px; border: 0; background: var(--surface); cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.seg button[aria-pressed="true"] { background: var(--acc-soft); color: var(--acc-ink); }

/* ---- 表 ---- */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); overflow: hidden; }
.table-scroll { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
table.t th, table.t td { padding: 9px 12px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line-2); }
table.t th { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
table.t tbody tr:last-child td { border-bottom: 0; }
table.t tbody tr { transition: background .12s var(--ease); }
table.t tbody tr:hover { background: var(--surface-2); }
table.t tbody tr.sel { background: var(--acc-soft); }
table.t td.n, table.t th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t td.c, table.t th.c { width: 36px; padding-right: 0; }
table.t td.name { min-width: 220px; }
.namecell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.namecell .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.namecell button.link { all: unset; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.namecell button.link:hover { color: var(--acc-ink); text-decoration: underline; }
.namecell button.link:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 4px; }
.fi { width: 30px; height: 30px; border-radius: 6px; display: grid; place-items: center; flex: 0 0 auto; background: var(--surface-2); color: var(--muted); overflow: hidden; }
.fi.folder { background: var(--acc-soft); color: var(--acc-ink); }
.fi img { width: 100%; height: 100%; object-fit: cover; display: block; }
.more { display: flex; justify-content: center; padding: 14px; }

/* ---- 写真の並び ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); overflow: hidden; cursor: pointer; transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
.tile:hover { box-shadow: var(--shadow); }
.tile.sel { border-color: var(--acc); box-shadow: 0 0 0 2px var(--acc); }
.tile .thumb { aspect-ratio: 1; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
.tile .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .cap { padding: 7px 9px; font-size: 12.5px; }
.tile .cap .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .tick { position: absolute; top: 8px; left: 8px; opacity: 0; transition: opacity .12s var(--ease); background: var(--surface); border-radius: 5px; padding: 3px; line-height: 0; }
.tile:hover .tick, .tile.sel .tick, .tiles.selecting .tick { opacity: 1; }

/* ---- 数字の並び(照合) ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 14px 16px; }
.stat .k { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.stat .v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 4px; letter-spacing: -.01em; }
.stat .s { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }

.chain { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: stretch; gap: 10px; }
.chain .node { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 14px 16px; min-width: 0; }
.chain .node h3 { margin: 0 0 6px; font-size: 13px; color: var(--muted); font-weight: 600; display: flex; gap: 6px; align-items: center; }
.chain .node .v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chain .node .s { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.chain .arrow { display: grid; place-items: center; color: var(--muted); }
@media (max-width: 860px) { .chain { grid-template-columns: 1fr; } .chain .arrow { transform: rotate(90deg); } }

.meter { height: 8px; border-radius: var(--r-pill); background: var(--line-2); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--acc); border-radius: var(--r-pill); }
.meter.warn > i { background: var(--warn); }

/* ---- 状態(空・読み込み・エラー) ---- */
.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty svg.i { width: 40px; height: 40px; color: color-mix(in srgb, var(--muted) 70%, transparent); margin-bottom: 8px; }
.empty .t { font-weight: 700; color: var(--ink-2); font-size: 15px; margin-bottom: 4px; }
.errbox { border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent); background: var(--bad-soft); color: var(--bad); border-radius: var(--r-control); padding: 10px 12px; display: flex; gap: 8px; align-items: flex-start; }
.note { border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--r-control); padding: 10px 12px; color: var(--ink-2); display: flex; gap: 8px; align-items: flex-start; }
.note svg.i { color: var(--acc); margin-top: 2px; }
.skel { display: block; height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--line-2), var(--surface-2), var(--line-2)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---- ダイアログ・引き出し ---- */
dialog.dlg {
  border: 1px solid var(--line); border-radius: var(--r-panel); padding: 0;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
  width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 48px);
}
dialog.dlg::backdrop { background: rgb(10 12 15 / .45); }
dialog.dlg[open] { animation: pop .18s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.985); } to { opacity: 1; transform: none; } }
.dlg .hd { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.dlg .hd h2 { margin: 0; font-size: 16px; flex: 1; }
.dlg .bd { padding: 16px; overflow: auto; }
.dlg .ft { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line-2); background: var(--surface-2); border-radius: 0 0 var(--r-panel) var(--r-panel); }

dialog.drawer {
  margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(460px, 100vw);
  border: 0; border-left: 1px solid var(--line); border-radius: 0; padding: 0;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
}
dialog.drawer::backdrop { background: rgb(10 12 15 / .3); }
dialog.drawer[open] { animation: slide .22s var(--ease); }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer .hd { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line-2); position: sticky; top: 0; background: var(--surface); }
.drawer .hd h2 { margin: 0; font-size: 15px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer .bd { padding: 14px; }
.preview { background: var(--surface-2); border-radius: var(--r-control); display: grid; place-items: center; min-height: 180px; overflow: hidden; margin-bottom: 14px; color: var(--muted); }
.preview img, .preview video { max-width: 100%; max-height: 60vh; display: block; }
dl.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: 12.5px; }
dl.kv dd { margin: 0; min-width: 0; }

.copyrow { display: flex; gap: 6px; }
.copyrow .input { font-family: var(--mono); font-size: 12.5px; }

/* ---- 通知 ---- */
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 100; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: var(--r-control); box-shadow: var(--shadow); display: flex; gap: 8px; align-items: center; animation: pop .18s var(--ease); max-width: min(420px, calc(100vw - 32px)); }
.toast.bad { background: var(--bad); color: #fff; }

/* ---- ログイン ---- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.login .card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 26px 24px; box-shadow: var(--shadow); }
.login .brand { margin-bottom: 18px; font-size: 18px; }
.login h1 { font-size: 16px; margin: 0 0 16px; }
.login .btn { width: 100%; height: 38px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
