/* 経費アプリのスタイル（1）色・文字・骨格・シート・通知・共通の部品。
   色と寸法は、キャンバス「経費アプリ UI案」F案（空色 H3）から写した。 */

:root {
  color-scheme: light;
  --ink: rgb(11, 33, 64);
  --muted: rgba(11, 33, 64, .82);
  --yen: rgba(11, 33, 64, .6);
  --line: rgba(11, 33, 64, .12);
  --chip: rgba(255, 255, 255, .55);
  --pill: rgba(255, 255, 255, .6);
  --sliver: rgba(255, 255, 255, .4);
  --glass: rgba(255, 255, 255, .5);
  --bubble: rgba(255, 255, 255, .38);
  --bubble-line: rgba(255, 255, 255, .75);
  --sheen: rgba(255, 255, 255, .55);
  --seg: rgba(255, 255, 255, .45);
  --hero: radial-gradient(110% 70% at 72% 100%, rgba(240, 248, 255, .9) 0%, rgba(240, 248, 255, 0) 70%),
    linear-gradient(172deg, #6FAEFF 0%, #9CC9FF 45%, #D3E7FF 100%);
  --full: radial-gradient(130% 50% at 50% 100%, rgba(240, 248, 255, .85) 0%, rgba(240, 248, 255, 0) 70%),
    linear-gradient(176deg, #6FAEFF 0%, #93C3FF 40%, #C2DEFF 80%, #D8EAFF 100%);
  --accent: #1F6FD6;
  --soft: #E6F0FF;
  --soft-ink: #1A55A8;
  --mark: linear-gradient(135deg, #4C93F5 0%, #1F5FC0 100%);
  --black: #111114;
  --text: #141416;
  --gray: #6B6B73;
  --faint: #A6A6AE;
  --border: #E4E4E8;
  --border-2: #EEEEF1;
  --border-3: #ECECEF;
  --tile: #F3F3F5;
  --danger: #C0352E;
  --warn-bg: #FFF3E0;
  --warn-ink: #7A4300;
  --sheet-shadow: 0 -12px 32px rgba(20, 20, 30, .06);
  --card-shadow: 0 12px 32px rgba(20, 20, 30, .1);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --font: "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

/* 上端のぼかしは最初に描いた背景色で着色されるので、最初から空色を敷く（PFCアプリで実測） */
html { background: #6FAEFF; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body {
  color: var(--text); font: 400 15px/1.5 var(--font);
  -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
input, textarea { -webkit-appearance: none; appearance: none; border-radius: 0; }
button {
  margin: 0; padding: 0; border: 0; background: none; text-align: inherit;
  cursor: pointer; touch-action: manipulation;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
button:disabled { opacity: .38; cursor: default; }
button:not(:disabled):active { opacity: .7; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
.icon { width: 22px; height: 22px; flex: none; display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.boot-note { padding: 120px 24px; text-align: center; color: var(--ink); font-weight: 600; }

/* ---------- ホーム画面アプリ（iOS 26以降の不具合対策。PFCアプリ 05_UI案 4章の方法） ----------
   1) 文書が画面より短いと表示域がステータスバー分短くなるので、文書の高さを画面いっぱいにする
   2) 表示域が戻らないOSでは .short-viewport に切り替える */
:root.standalone { height: min(100lvh, calc(100% + var(--sat))); }
:root.standalone .app { height: 100%; }
:root.standalone.short-viewport { height: 100%; }
:root.standalone.short-viewport .app { height: 100vh; height: 100dvh; }

/* ---------- 画面の骨格 ---------- */
.app {
  position: relative; height: 100vh; height: 100dvh; max-width: 480px; margin: 0 auto;
  overflow: hidden; isolation: isolate; background: #fff;
  container: app / size;   /* 高さの判定は @media ではなくアプリの実高さで（iOSのホーム画面アプリ対策） */
}
#screens { position: absolute; inset: 0; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; overflow: hidden; background: #fff; }
.screen.enter { animation: slide-in .26s cubic-bezier(.2, .8, .2, 1); box-shadow: -8px 0 24px rgba(11, 33, 64, .12); }
.screen.leave { animation: slide-out .2s ease-in forwards; z-index: 2; }
.screen.covered { visibility: hidden; }
@keyframes slide-in { from { transform: translateX(100%); } }
@keyframes slide-out { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .screen.enter, .screen.leave, .sheet, .toast { animation-duration: .01s; } }

/* 色の上の部分（上は空色のグラデーション） */
.hero { position: relative; flex: none; color: var(--ink); background: var(--hero); padding: max(10px, var(--sat)) 16px 0; }
.bar { height: 44px; display: flex; align-items: center; gap: 8px; }
.bar .title { flex: 1; text-align: center; font-size: 16px; font-weight: 700; }
.bar .spacer { width: 44px; flex: none; }
.round { position: relative; width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--chip); color: var(--ink); }
.badge {
  position: absolute; top: -3px; right: -3px; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 700; line-height: 20px; text-align: center;
}
.big { font-size: 56px; font-weight: 600; line-height: 1.12; letter-spacing: -.01em; color: var(--ink); white-space: nowrap; }
.big .y { font-size: 30px; font-weight: 600; color: var(--yen); margin-right: 4px; }
.big .unit { font-size: 22px; color: var(--yen); margin-left: 4px; }
.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 4px 14px; border-radius: 16px; background: var(--pill); font-size: 13px; font-weight: 600; color: var(--ink); }

/* 白いシート（下） */
.paper {
  position: relative; z-index: 1; flex: 1; min-height: 0; margin-top: -24px;
  display: flex; flex-direction: column; border-radius: 28px 28px 0 0; background: #fff; box-shadow: var(--sheet-shadow);
}
.paper .scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px 16px; scrollbar-width: none; }
.paper .scroll::-webkit-scrollbar { display: none; }
.foot { flex: none; padding: 10px 16px max(14px, var(--sab)); background: #fff; }
:root.keyboard .foot { padding-bottom: 10px; }

.sec-head { display: flex; align-items: center; justify-content: space-between; min-height: 40px; gap: 8px; }
.sec-head h2 { font-size: 18px; font-weight: 700; }
.sec-head h3 { font-size: 15px; font-weight: 700; }
.sec-head .count { font-size: 13px; color: var(--gray); font-weight: 600; }
.link { min-height: 44px; padding: 0 2px; font-size: 14px; font-weight: 600; color: var(--gray); display: inline-flex; align-items: center; gap: 2px; }
.link .icon { width: 16px; height: 16px; }

/* ---------- 記録の行 ---------- */
.row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 8px 0; text-align: left; }
.thumb { width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center; overflow: hidden; background: var(--tile); color: var(--ink); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.flagged { background: var(--warn-bg); color: var(--warn-ink); }
.row .main { flex: 1; min-width: 0; }
.row .t { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s { font-size: 12px; color: var(--gray); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .end { flex: none; text-align: right; max-width: 45%; }
.row .amt { font-size: 15px; font-weight: 700; white-space: nowrap; }
.row .when { font-size: 12px; color: var(--gray); white-space: nowrap; }
.row .when.warn { color: var(--warn-ink); font-weight: 600; }
.empty { padding: 18px 4px; color: var(--gray); font-size: 14px; line-height: 1.7; }

/* ---------- 押せる部品 ---------- */
.chip {
  height: 44px; padding: 0 16px; flex: none; border-radius: 22px; display: inline-flex; align-items: center; gap: 6px;
  background: var(--tile); color: var(--text); font-size: 14px; font-weight: 600; white-space: nowrap;
}
.chip .icon { width: 18px; height: 18px; }
.chip.on { background: var(--accent); color: #fff; }
.chip.pinned::before { content: ""; width: 6px; height: 6px; border-radius: 3px; background: var(--accent); }
.chip .sub { color: var(--gray); font-weight: 500; }
.chip.on .sub { color: rgba(255, 255, 255, .85); }

.go {
  width: 100%; height: 60px; padding: 0 6px 0 24px; border-radius: 30px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--black); color: #fff; font-size: 16px; font-weight: 700;
}
.go .dot { width: 48px; height: 48px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--mark); color: #fff; }
.ghost {
  min-height: 48px; padding: 0 18px; border-radius: 24px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); background: #fff; color: var(--text); font-size: 14px; font-weight: 700;
}
.ghost.wide { width: 100%; }
.ghost.danger { color: var(--danger); }
.ghost .icon { width: 18px; height: 18px; }

.say {
  display: flex; align-items: center; gap: 8px; height: 60px; padding: 0 6px 0 20px; border-radius: 30px;
  background: #fff; border: 1px solid var(--border-3); box-shadow: var(--card-shadow);
}
.say input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; font-size: 16px; color: var(--text); }
.say input::placeholder { color: #8A8A93; }
.say .send { width: 48px; height: 48px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--black); color: #fff; }

.note { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0; padding: 10px 12px; border-radius: 14px; background: var(--warn-bg); color: var(--warn-ink); font-size: 13px; line-height: 1.6; }
.note .icon { width: 18px; height: 18px; margin-top: 1px; }
.note .act { margin-left: auto; flex: none; min-height: 32px; padding: 0 12px; border-radius: 16px; background: #fff; color: var(--warn-ink); font-size: 13px; font-weight: 700; }
.note.info { background: var(--soft); color: var(--soft-ink); }
.note.info .act { color: var(--soft-ink); }

/* ---------- 下から出るシート ---------- */
#layer:empty { display: none; }
#layer { position: absolute; inset: 0; z-index: 10; }
.shade { position: absolute; inset: 0; width: 100%; background: rgba(11, 33, 64, .32); animation: fade .2s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: var(--kb, 0px);
  max-height: calc(100% - var(--sat) - var(--vt, 0px) - 12px - var(--kb, 0px));
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: 28px 28px 0 0; background: #fff; box-shadow: var(--sheet-shadow); animation: rise .22s ease-out;
}
.sheet.tall { height: calc(100% - var(--sat) - var(--vt, 0px) - 12px - var(--kb, 0px)); }
@keyframes rise { from { transform: translateY(32px); opacity: .6; } }
@keyframes fade { from { opacity: 0; } }
.sh-head { flex: none; display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; padding: 10px 10px 0; }
.sh-head h2 { grid-column: 2; text-align: center; font-size: 16px; font-weight: 700; }
.sh-head .x { grid-column: 3; width: 44px; height: 44px; display: grid; place-items: center; color: var(--gray); }
.sh-body { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 20px 16px; overscroll-behavior: contain; }
.sh-foot { flex: none; display: flex; gap: 10px; padding: 8px 16px max(16px, var(--sab)); }
.sh-foot > * { flex: 1; }
:root.keyboard .sh-foot { padding-bottom: 10px; }
.sh-text { font-size: 14px; line-height: 1.75; color: var(--text); }
.sh-text + .sh-text { margin-top: 8px; }
.sh-text.gray { color: var(--gray); font-size: 13px; }

/* ---------- 通知（取り消す） ---------- */
.toast {
  /* 見出しの「戻る」などを隠さないよう、見出しの下に出す */
  position: absolute; z-index: 20; left: 12px; right: 12px; top: calc(max(10px, var(--sat)) + 50px);
  min-height: 52px; padding: 4px 6px 4px 18px; display: flex; align-items: center; gap: 2px;
  border-radius: 26px; background: var(--black); color: #fff; box-shadow: var(--card-shadow); animation: drop .22s ease-out;
}
.toast:empty { display: none; }
@keyframes drop { from { transform: translateY(-16px); opacity: 0; } }
.toast span { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; }
.toast button { min-height: 44px; padding: 0 12px; border-radius: 22px; font-size: 14px; font-weight: 700; color: #9CC9FF; white-space: nowrap; }

/* ---------- 入力 ---------- */
.input {
  width: 100%; height: 52px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--border); background: #fff;
  font-size: 16px; color: var(--text); outline: none;
}
.input:focus { border-color: var(--accent); }
textarea.input { height: 120px; padding: 12px 16px; resize: none; line-height: 1.6; }
.label { display: block; margin: 14px 0 6px; font-size: 13px; color: var(--gray); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 4px; border-bottom: 1px solid var(--border-2); text-align: left; }
.choice .main { flex: 1; min-width: 0; }
.choice .main small { display: block; color: var(--gray); font-size: 12px; }
.choice .mark { width: 24px; height: 24px; flex: none; color: var(--accent); }

/* ---------- 追加の部品 ---------- */
.amt-input input::placeholder { color: #C9C9D0; }
.ghost.solid { background: var(--black); border-color: var(--black); color: #fff; }
.ghost.solid.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
label.ghost, label.field { cursor: pointer; }
.input.date { display: flex; align-items: center; text-align: left; }
.input.date::-webkit-date-and-time-value { text-align: left; }
.home.typing .tpls, .home.typing .tpl-label { display: none; }
