/* 経理ポケット — 業務UIモード(あべこDESIGN.md: 14px×行間1.5・#46281A・#FFFDF8・accent #E08A3C) */
:root {
  --text: #46281A; --text-2: rgba(70,40,26,0.66); --text-3: rgba(70,40,26,0.45);
  --bg: #FFFDF8; --bg-2: #FBEFD9; --card: #FFFFFF; --line: rgba(70,40,26,0.14);
  --accent: #E08A3C; --accent-strong: #C8461B; --navy: #1B2A4A;
  --ok: #1e7b65; --danger: #b22323; --warn: #916626;
  --rev: #E08A3C; --exp: #3B6EA5;
  --radius: 12px; --tabs-h: 64px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif; font-size: 14px; line-height: 1.5;
  font-variant-numeric: tabular-nums; -webkit-text-size-adjust: 100%; }
body { padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom)); }
h1, h2, h3 { margin: 0; font-weight: 700; }
button { font: inherit; color: inherit; }
a { color: var(--accent-strong); }
[hidden] { display: none !important; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 16px; }
.badge { font-size: 11px; color: var(--text-3); }
.view { padding: 14px 14px 20px; max-width: 720px; margin: 0 auto; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tabs-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: 1fr 1fr 1fr; background: #fff; border-top: 1px solid var(--line); z-index: 5; }
.tabs button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; color: var(--text-2); position: relative; }
.tabs button .ico { font-size: 22px; line-height: 1; }
.tabs button.active { color: var(--accent-strong); font-weight: 700; }
.tabs .count { position: absolute; top: 8px; right: calc(50% - 26px); background: var(--accent-strong); color: #fff; font-size: 10px; min-width: 18px; height: 18px; border-radius: 9px; display: none; align-items: center; justify-content: center; padding: 0 5px; }
.tabs .count.on { display: inline-flex; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.card h2 { font-size: 15px; margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; }
.card h2 small { font-weight: 400; color: var(--text-3); font-size: 12px; }
.muted { color: var(--text-2); }
.small { font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; }
.between { justify-content: space-between; }
.right { text-align: right; }

.btn { border: 1px solid rgba(70,40,26,0.22); background: transparent; border-radius: 8px; padding: 10px 16px; cursor: pointer; font-weight: 600; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:active { background: var(--accent-strong); }
.btn.strong { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.btn.danger { color: var(--danger); border-color: rgba(178,35,35,0.4); }
.btn.block { width: 100%; }
.btn.sm { padding: 6px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; }

.capture-hero { text-align: center; padding: 28px 12px 18px; }
.capture-hero .big { width: 100%; max-width: 360px; font-size: 20px; padding: 22px; border-radius: 16px; box-shadow: 0 6px 18px rgba(224,138,60,0.35); }
.capture-hero .big .ico { display: block; font-size: 44px; margin-bottom: 6px; }
.capture-hero p { margin: 14px 0 0; }
.capture-hero .sub { color: var(--text-2); font-size: 13px; }
.progress { display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--bg-2); border-radius: 10px; }
.spinner { width: 18px; height: 18px; border: 3px solid rgba(70,40,26,0.2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.receipt { display: grid; grid-template-columns: 96px 1fr; gap: 12px; }
.receipt img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--bg-2); }
.receipt .amount { font-size: 22px; font-weight: 700; }
.pill { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--bg-2); color: var(--text-2); }
.pill.ok { background: rgba(30,123,101,0.12); color: var(--ok); }
.pill.warn { background: rgba(145,102,38,0.12); color: var(--warn); }
.pill.danger { background: rgba(178,35,35,0.10); color: var(--danger); }
.pill.navy { background: rgba(27,42,74,0.10); color: var(--navy); }

form.confirm label { display: block; font-size: 12px; color: var(--text-2); margin: 10px 0 4px; }
form.confirm input, form.confirm select, form.confirm textarea { width: 100%; height: 40px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; color: var(--text); }
form.confirm textarea { height: 64px; }
form.confirm input:focus, form.confirm select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 9px 4px; font-size: 13px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--navy); color: #fff; font-weight: 700; }
.hint { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.basis { font-size: 12px; color: var(--ok); }
.dup { border: 1px solid rgba(145,102,38,0.4); background: rgba(145,102,38,0.06); border-radius: 8px; padding: 8px 10px; margin-top: 10px; }
.dup .item { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px dashed var(--line); font-size: 13px; }
.dup .item:first-of-type { border-top: 0; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; }
.check input { width: 20px; height: 20px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.actions .btn.block { grid-column: 1 / -1; }

.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 8px; min-width: 0; overflow: hidden; }
.kpi .l { font-size: 11px; color: var(--text-2); }
.kpi .v { font-size: 17px; font-weight: 700; margin-top: 2px; white-space: nowrap; letter-spacing: -0.02em; }
.kpi .v.long { font-size: 14px; }
.kpi .d { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos { color: var(--ok); } .neg { color: var(--danger); }

.chart { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th, table.t td { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.t th { font-weight: 600; color: var(--text-2); font-size: 12px; }
table.t td.n, table.t th.n { text-align: right; white-space: nowrap; }
.list .li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.list .li:first-child { border-top: 0; }
.list .li .t1 { font-weight: 600; }
.list .li .t2 { font-size: 12px; color: var(--text-2); }
.list .li .amt { white-space: nowrap; font-weight: 700; }
.bar { height: 8px; background: var(--bg-2); border-radius: 4px; overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; background: var(--exp); border-radius: 4px; }
.empty { text-align: center; color: var(--text-3); padding: 20px 0; }
.toast { position: fixed; left: 50%; bottom: calc(var(--tabs-h) + 16px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13px; z-index: 20; max-width: 90vw; }
.alert { background: rgba(178,35,35,0.08); color: var(--danger); padding: 8px 10px; border-radius: 8px; font-size: 13px; }
.linkbtn { border: 0; background: none; color: var(--accent-strong); text-decoration: underline; padding: 0; cursor: pointer; }

body.login { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card { width: 100%; max-width: 360px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 28px 22px; text-align: center; }
.login-card .logo { font-size: 44px; }
.login-card h1 { font-size: 20px; margin-top: 6px; }
.login-card .sub { color: var(--text-2); font-size: 13px; }
.login-card label { display: block; text-align: left; font-size: 12px; color: var(--text-2); margin: 14px 0 6px; }
.login-card input { width: 100%; height: 42px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font: inherit; }
.login-card .btn { width: 100%; margin-top: 14px; }

/* v0.2: 撮るだけ・シマエナガの確認 */
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: var(--bg-2); flex: none; }
.list .li[data-open] { cursor: pointer; }
.outbox { background: var(--bg-2); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-size: 13px; }
.card.q .qtext { margin-top: 10px; font-weight: 700; }
.card.q .hint { margin-top: 2px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.btn.opt { flex: 1 1 auto; min-height: 44px; background: #fff; }
.btn.opt:active { background: var(--navy); color: #fff; }
.card.busy { opacity: .5; pointer-events: none; }
select.acc-more, select.card-edit { height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; font: inherit; background: #fff; color: var(--text); }
select.acc-more { width: 100%; }
.warn-text { color: var(--warn); }
.sheet { position: fixed; inset: 0; background: rgba(27,42,74,0.35); z-index: 30; display: flex; align-items: flex-end; justify-content: center; }
.sheet-body { background: var(--bg); width: 100%; max-width: 720px; max-height: 88vh; overflow-y: auto; border-radius: 16px 16px 0 0; padding: 16px 14px calc(20px + env(safe-area-inset-bottom)); }
.sheet-body .receipt { margin: 10px 0; }
.sheet-body .card.q { margin-top: 10px; }
.login-card .howto { text-align: left; margin-top: 16px; font-size: 12px; color: var(--text-2); }
.login-card .howto code { font-size: 11px; background: var(--bg-2); padding: 1px 4px; border-radius: 4px; word-break: break-all; }
.login-card input[name=code] { letter-spacing: 0.08em; text-transform: uppercase; font-size: 18px; text-align: center; }
.seg button { white-space: normal; line-height: 1.25; font-size: 12.5px; }
.card.q .qtext:first-child { margin-top: 0; }
