/* ワイズ会計 - 色: 淡い黄色ベース + 淡い青・淡い緑 (文字は濃い色で読みやすく) */
:root {
  --bg: #eaf1f7;          /* 淡い水色 (背景) */
  --surface: #ffffff;     /* カード */
  --line: #d3e0ea;        /* 枠線 */
  --text: #2b2212;        /* 文字 */
  --sub: #665a40;         /* 小さい文字 */
  --blue-soft: #fbe9bf;   /* 淡いアンバー (選択・背景用) */
  --blue: #a86500;        /* 濃いアンバー (文字・枠の強調) */
  --accent: #f2b233;      /* アンバー (ボタンの塗り) */
  --accent-hover: #e9a21a;
  --accent-ink: #3a2400;  /* アンバーの上の文字 */
  --side: #fbe3b0;        /* 左メニューの背景 */
  --green-soft: #e2f3e6;  /* 淡い緑 (背景用) */
  --green: #2e7d4f;       /* 緑 (文字・強調) */
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  /* 日本語: BIZ UDPゴシック (読みやすいUDフォント) / 韓国語: Noto Sans KR (下の :lang(ko) で切り替え) */
  font-family: "BIZ UDPGothic", "Noto Sans KR", "Meiryo", "Malgun Gothic", system-ui, sans-serif;
  font-size: 17px;
}

.layout { display: flex; flex-wrap: wrap; min-height: 100vh; }

/* 左メニュー */
.side {
  flex: 0 0 260px;
  max-width: 100%;
  background: var(--side);
  padding: 24px 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.brand { padding: 0 12px 20px; display: flex; flex-direction: column; gap: 4px; }
.brand-name { font-size: 23px; font-weight: 700; color: #5a3a00; }
.brand-shop { font-size: 15px; color: #4a3510; }
.menu {
  display: flex; align-items: center;
  min-height: 52px; padding: 0 14px; border-radius: 12px;
  color: #4a3510; text-decoration: none; font-size: 17px;
}
.menu:hover { background: rgba(255,255,255,.45); }
.menu.active { background: #f4bd4a; color: var(--accent-ink); font-weight: 700; }

/* 右の本体 */
.main {
  flex: 999 1 560px; min-width: 0; max-width: 1200px;
  padding: 28px 36px 40px;
  display: flex; flex-direction: column; gap: 22px;
}
.top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.top-left, .top-right { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
h1 { margin: 0; font-size: 28px; }
h2 { margin: 0 0 8px; font-size: 19px; }

.pill {
  min-height: 44px; padding: 0 16px; border-radius: 22px;
  border: 1px solid var(--line); background: var(--surface);
  font: inherit; font-size: 16px; color: var(--text); cursor: pointer;
}

/* 信号の帯 */
.signal { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-radius: 14px; font-size: 18px; font-weight: 500; }
.signal .dot { width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0; }
.signal.ok { background: var(--green-soft); color: var(--green); }
.signal.ok .dot { background: var(--green); }

/* 今月のまとめ */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.card { background: var(--surface); border-radius: 16px; padding: 20px 22px; display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--line); }
.card .label { font-size: 16px; color: var(--sub); }
.card .num { font-size: 28px; font-weight: 700; }
.card.profit { background: var(--green-soft); border-color: transparent; }
.card.profit .num { color: var(--green); }

/* よく使う操作 */
.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.act {
  min-height: 84px; border-radius: 16px;
  border: 1px solid var(--line); background: var(--surface);
  font: inherit; font-size: 19px; font-weight: 700; color: var(--text); cursor: pointer;
}
.act:hover { background: var(--blue-soft); }
.act.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.act.primary:hover { background: var(--accent-hover); }

/* 最近の記録 */
.box { background: var(--surface); border-radius: 16px; padding: 20px 22px; border: 1px solid var(--line); }
.empty { color: var(--sub); margin: 8px 0 0; }

/* スマホ幅 */
@media (max-width: 700px) {
  .side { flex: 1 1 100%; border-right: none; border-bottom: 1px solid var(--line); flex-direction: row; flex-wrap: wrap; padding: 12px; }
  .brand { width: 100%; padding: 0 4px 8px; }
  .menu { min-height: 44px; }
  .main { padding: 20px 16px 32px; }
}

/* ===== v0.2 追加: 画面切り替え・経費フォーム ===== */
.view { display: flex; flex-direction: column; gap: 22px; }
.view[hidden] { display: none; }
a.act { display: flex; align-items: center; justify-content: center; text-decoration: none; text-align: center; padding: 0 12px; }

.two-col { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.form { flex: 3 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 22px; padding: 24px 26px; }
.side-col { flex: 2 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }

.row { display: flex; flex-wrap: wrap; gap: 16px; }
.field { flex: 1 1 200px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.wide { flex: 2 1 260px; }
fieldset { border: none; margin: 0; padding: 0; min-width: 0; }
legend, .field > label { font-size: 16px; font-weight: 700; padding: 0 0 8px; }
.field > label { padding: 0; }
input[type="text"], input[type="date"] {
  height: 52px; border: 1px solid #d9d1b0; border-radius: 10px; padding: 0 14px;
  font: inherit; font-size: 18px; color: var(--text); background: #ffffff; width: 100%;
}
input:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid #e7c06a; outline-offset: 2px; }

.chips-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.chip {
  min-height: 64px; border: 1px solid #d9d1b0; background: #ffffff; border-radius: 12px;
  font: inherit; font-size: 16px; color: var(--text); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px;
}
.chip .sub { font-size: 13px; color: var(--sub); }
.chip:hover { background: var(--bg); }
.chip[aria-pressed="true"] { border: 2px solid var(--blue); background: var(--blue-soft); color: var(--blue); font-weight: 700; }
.chip[aria-pressed="true"] .sub { color: var(--blue); }

.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pills.small { margin-top: 8px; }
.pills[hidden] { display: none; }
.opt {
  min-height: 48px; padding: 0 18px; border-radius: 24px; border: 1px solid #d9d1b0; background: #ffffff;
  font: inherit; font-size: 16px; color: var(--text); cursor: pointer;
}
.pills.small .opt { min-height: 44px; font-size: 15px; }
.opt[aria-pressed="true"] { border: 2px solid var(--blue); background: var(--blue-soft); color: var(--blue); font-weight: 700; }
.opt.green[aria-pressed="true"] { border-color: var(--green); background: var(--green-soft); color: var(--green); }

.btn {
  flex: 1 1 160px; min-height: 60px; border-radius: 14px; border: 1px solid #d9d1b0; background: #ffffff;
  font: inherit; font-size: 17px; color: var(--text); cursor: pointer;
}
.btn.primary { flex: 2 1 220px; border: none; background: var(--accent); color: var(--accent-ink); font-size: 19px; font-weight: 700; }
.btn.primary:hover { background: var(--accent-hover); }

.preview { background: var(--green-soft); border-color: transparent; display: flex; flex-direction: column; gap: 12px; }
.preview h2 { color: var(--green); }
.pv-row { display: flex; justify-content: space-between; gap: 12px; font-size: 16px; }
.pv-note { margin: 0; padding-top: 10px; border-top: 1px solid #b9dcc3; font-size: 14px; color: #2a4a35; }

.msg { margin: 0; padding: 12px 16px; border-radius: 10px; font-size: 16px; font-weight: 500; }
.msg.ok { background: var(--green-soft); color: var(--green); }
.msg.ng { background: #fde8e4; color: #a3341f; }

.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 16px; }
.tbl td { padding: 12px 8px; border-bottom: 1px solid #f0ead2; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: none; }
.tbl td.num { text-align: right; font-weight: 700; }
.tbl td.warn { color: #a3501a; font-weight: 500; }
.card.profit.neg { background: #fde8e4; }
.card.profit.neg .num { color: #a3341f; }

/* ===== ログイン画面 ===== */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-box {
  width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  padding: 40px 32px; display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center;
}
.login-box .brand-name { margin: 0; font-size: 32px; }
.login-lead { margin: 0; font-size: 18px; color: var(--sub); }
.login-btn { display: flex; align-items: center; justify-content: center; width: 100%; flex: none; text-decoration: none; }
.btn.primary.login-btn { flex: none; min-height: 60px; }

/* ===== v0.3 追加: 記録一覧・直す・削除 ===== */
[hidden] { display: none !important; }
.monthbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.monthbar .cur { font-size: 22px; font-weight: 700; min-width: 150px; text-align: center; }
.monthsum { margin-left: auto; font-size: 17px; color: var(--sub); }
.monthsum b { color: var(--text); font-size: 20px; }
.tbl th { font-size: 14px; color: var(--sub); text-align: left; padding: 8px; border-bottom: 1px solid var(--line); font-weight: 500; white-space: nowrap; }
.tbl th.num { text-align: right; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--blue-soft); }
.tbl td.go { color: var(--blue); font-weight: 700; text-align: center; }
.editband { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-radius: 14px; background: #fff1c9; color: #7a5200; font-size: 18px; font-weight: 700; }
.btn.danger { border: 2px solid #c0472f; color: #a3341f; background: #ffffff; font-weight: 700; }
.btn.danger.solid { background: #c0472f; color: #ffffff; }
.confirm { border: 2px solid #c0472f; background: #fde8e4; border-radius: 14px; padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.confirm p { margin: 0; font-size: 18px; font-weight: 700; color: #a3341f; }
#delWhat { font-size: 17px; }
/* メモ欄の下に余計なすき間ができないように */
.form > .field { flex: none; }

/* ===== v0.4 追加: レシートから入力 ===== */
.upl { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; background: var(--blue-soft); border: 2px dashed #e7c06a; border-radius: 16px; padding: 20px 24px; }
.upl .big { min-height: 64px; padding: 0 28px; border-radius: 14px; border: none; background: var(--accent); color: var(--accent-ink); font: inherit; font-size: 19px; font-weight: 700; cursor: pointer; }
.upl .big:hover { background: var(--accent-hover); }
.upl .big:disabled { opacity: .6; cursor: wait; }
.upl .hint { color: #1e4a75; font-size: 16px; line-height: 1.6; }
.msg.info { background: var(--blue-soft); color: var(--blue); }
.rc-list { display: flex; flex-direction: column; gap: 14px; }
.rc-head { font-size: 19px; font-weight: 700; color: var(--green); background: var(--green-soft); padding: 14px 20px; border-radius: 14px; }
.rc { display: flex; gap: 18px; background: #ffffff; border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; flex-wrap: wrap; }
.rc .ph { width: 110px; height: 150px; border-radius: 10px; border: 1px solid var(--line); overflow: hidden; display: flex; align-items: center; justify-content: center; background: #faf8ef; color: var(--sub); font-size: 15px; text-decoration: none; flex-shrink: 0; }
.rc .ph img { width: 100%; height: 100%; object-fit: cover; }
.rc .info { flex: 1 1 300px; display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; font-size: 17px; align-content: start; }
.rc .info > span { color: var(--sub); }
.rc .btns { display: flex; flex-direction: column; gap: 10px; flex: 0 0 210px; }
.rc .btns .btn { flex: none; min-height: 52px; }
.rc .btn:disabled { opacity: .45; cursor: not-allowed; }
.rc .note { font-size: 14px; color: #a3501a; }
.rc.done, .rc.skip { opacity: .6; }
.rc .state { font-size: 18px; font-weight: 700; color: var(--green); }
.rc.skip .state { color: var(--sub); }
.tag { display: inline-block; font-size: 13px; padding: 2px 10px; border-radius: 10px; background: #fff1c9; color: #7a5200; margin-left: 6px; font-weight: 700; }
.attached { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; background: var(--green-soft); border-radius: 12px; padding: 12px 16px; font-size: 16px; color: var(--green); font-weight: 700; }
.attached a { color: var(--blue); }
.rcpt-link { text-decoration: none; margin-left: 4px; }

/* ツールチップ・写真アイコン */
.tip { position: fixed; z-index: 1000; max-width: 440px; padding: 10px 14px; border-radius: 10px;
  background: #ffffff; color: var(--text); border: 1px solid #d9d1b0; font-size: 15px; line-height: 1.55;
  pointer-events: none; box-shadow: 0 4px 14px rgba(60,50,10,.15); }
.rcpt-icon { display: inline-flex; align-items: center; padding: 3px; border-radius: 8px; }
.rcpt-icon:hover { background: #ffffff; }
.rcpt-link { display: inline-flex; vertical-align: middle; }
.ico { display: block; }
.attached.off { background: #f3f0e2; color: var(--sub); }
.tip, #rcptMsg, [data-brk] { white-space: pre-line; }
/* 「写真がついています」と「外しました」の箱は同じ高さ (切り替えても画面が動かないように) */
.attached { min-height: 76px; }

/* ===== v0.5 追加: メニュー・ホーム・財務報告 ===== */
.menu .soon { margin-left: auto; font-size: 12px; color: #4a3510; background: rgba(255,255,255,.55); padding: 2px 8px; border-radius: 8px; }
.menu.dim { color: #8a7340; }
.card .sub2 { font-size: 14px; color: var(--sub); }
.card.warnc { background: #fff6e0; border-color: #f0dca8; }
.card.warnc .num { color: #a3501a; }
.monthbar .grow { flex: 1; }
.tabs-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab { min-height: 50px; padding: 0 22px; border-radius: 12px; border: 1px solid var(--line); background: #ffffff; font: inherit; font-size: 17px; color: var(--text); cursor: pointer; }
.tab[aria-pressed="true"] { background: var(--blue-soft); color: var(--blue); border: 2px solid var(--blue); font-weight: 700; }
.chk { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 16px; color: var(--sub); cursor: pointer; }
.chk input { width: 20px; height: 20px; }
.rep { width: 100%; border-collapse: collapse; font-size: 17px; }
.rep td { padding: 12px 10px; border-bottom: 1px solid #f0ead2; vertical-align: top; }
.rep td.num { text-align: right; font-weight: 700; white-space: nowrap; }
.rep .easy { display: block; font-size: 13px; color: var(--sub); font-weight: 400; }
.rep .code, .rep-jr .code { display: inline-block; min-width: 42px; margin-right: 4px; color: var(--sub); font-size: 14px; font-weight: 400; }
.rep tr.sec td { background: #faf6e4; font-weight: 700; color: #5c5a4e; font-size: 15px; padding: 8px 10px; }
.rep tr.tot td { background: var(--blue-soft); color: var(--blue); font-weight: 700; }
.rep tr.big td { background: var(--green-soft); color: var(--green); font-weight: 700; font-size: 20px; }
.rep tr.big.neg td { background: #fde8e4; color: #a3341f; }
.rep .minus { color: #a3341f; }
.rep-note { font-size: 14px; color: var(--sub); margin: 10px 0 0; white-space: pre-line; }
.rep-ok { font-size: 15px; font-weight: 700; color: var(--green); margin: 0; }
.rep-ng { font-size: 15px; font-weight: 700; color: #a3341f; margin: 0; }
.bs-two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 800px) { .bs-two { grid-template-columns: 1fr; } .chk { margin-left: 0; } }

/* ===== 年・月の選び方 (記録一覧・財務報告) ===== */
.per { display: flex; flex-direction: column; gap: 12px; }
.per-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.per-top .yr { font-size: 22px; font-weight: 700; min-width: 100px; text-align: center; }
.per-top .arrow { width: 48px; min-height: 46px; border-radius: 12px; border: 1px solid var(--line); background: #ffffff; font: inherit; font-size: 16px; color: var(--text); cursor: pointer; }
.per-top .arrow:hover, .mbtn:hover { background: var(--blue-soft); }
.per-top .sum { margin-left: auto; font-size: 17px; color: var(--sub); }
.per-top .sum b { color: var(--text); font-size: 20px; }
.mgrid { display: grid; grid-template-columns: repeat(13, 1fr); gap: 6px; }
.mbtn { min-height: 50px; border-radius: 12px; border: 1px solid var(--line); background: #ffffff; font: inherit; font-size: 16px; color: var(--text); cursor: pointer; padding: 0; white-space: nowrap; }
.mbtn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.mbtn.year { background: var(--green-soft); color: var(--green); font-weight: 700; border-color: #b9dcc3; }
.mbtn.year[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #ffffff; }
@media (max-width: 900px) { .mgrid { grid-template-columns: repeat(7, 1fr); } }
.menu .soon { margin-left: auto; } .menu { gap: 6px; }

/* 韓国語表示のときは Noto Sans KR を先に (日本語の文字は BIZ UDPゴシック で表示) */
html:lang(ko) body { font-family: "Noto Sans KR", "BIZ UDPGothic", "Malgun Gothic", "Meiryo", system-ui, sans-serif; }

/* ===== v0.6 追加: 設定・ボタンの並べ替え ===== */
.sec h2 { font-size: 20px; margin: 0 0 4px; }
.sec .desc { color: var(--sub); font-size: 15px; margin: 0 0 14px; }
#view-settings { gap: 18px; }
.frow { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; }
.frow .field { flex: 1 1 220px; }
.save { min-height: 52px; padding: 0 28px; border-radius: 12px; border: none; background: var(--accent); color: var(--accent-ink); font: inherit; font-size: 17px; font-weight: 700; cursor: pointer; }
.save:hover { background: var(--accent-hover); }
.sec .msg { margin-top: 12px; }
.btable { width: 100%; border-collapse: collapse; font-size: 16px; min-width: 640px; }
.btable th { font-size: 14px; color: var(--sub); text-align: left; padding: 8px; border-bottom: 1px solid var(--line); font-weight: 500; white-space: nowrap; }
.btable td { padding: 8px; border-bottom: 1px solid #f0ead2; }
.btable input, .btable select { height: 44px; border: 1px solid #d9d1b0; border-radius: 8px; padding: 0 10px; font: inherit; font-size: 16px; width: 100%; background: #ffffff; color: var(--text); }
.btable tr.hid td:not(:last-child) { opacity: .5; }
.sw { display: inline-flex; align-items: center; gap: 8px; border: none; background: none; font: inherit; font-size: 15px; color: var(--text); cursor: pointer; padding: 4px; white-space: nowrap; }
.sw i { width: 46px; height: 26px; border-radius: 13px; background: #cfc8ad; position: relative; display: inline-block; transition: background .15s; }
.sw i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #ffffff; transition: left .15s; }
.sw[aria-pressed="true"] i { background: var(--green); }
.sw[aria-pressed="true"] i::after { left: 23px; }
.add { min-height: 48px; padding: 0 20px; border-radius: 12px; border: 2px dashed #e7c06a; background: var(--blue-soft); color: var(--blue); font: inherit; font-weight: 700; font-size: 16px; margin-top: 12px; cursor: pointer; }
.ord { display: flex; gap: 10px; margin-top: 16px; align-items: center; flex-wrap: wrap; font-size: 15px; }
.btn-mini { min-height: 40px; padding: 0 16px; border-radius: 10px; border: none; background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 700; cursor: pointer; }

/* ボタンの長押し → ゆらゆら並べ替え */
.chip { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.donebar { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: #fff6e0; border: 1px solid #f0dca8; border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; font-size: 15px; color: #7a5200; font-weight: 700; }
.donebar button { min-height: 42px; padding: 0 22px; border-radius: 10px; border: none; background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 700; cursor: pointer; }
@keyframes jig { 0% { transform: rotate(-1.3deg); } 50% { transform: rotate(1.3deg); } 100% { transform: rotate(-1.3deg); } }
.chips-grid.jig .chip { animation: jig .32s infinite; position: relative; touch-action: none; cursor: grab; }
.chips-grid.jig .chip:nth-child(2n) { animation-delay: .12s; }
.chips-grid.jig .chip.drag { animation: none; z-index: 5; box-shadow: 0 8px 20px rgba(0,0,0,.18); background: var(--blue-soft); cursor: grabbing; }
.chip .x { position: absolute; top: -9px; left: -9px; width: 28px; height: 28px; border-radius: 50%; background: #8a8778; color: #ffffff; font-size: 16px; line-height: 28px; text-align: center; font-weight: 700; }
.btable td:nth-child(3) { min-width: 170px; }
.btable td:nth-child(4) { width: 110px; }
.btable td:nth-child(5) { width: 120px; }

/* 並べ替え中だけ右下に浮かぶ「完了」ボタン (FAB) */
.fab { position: fixed; right: 20px; bottom: 24px; z-index: 900; min-height: 60px; padding: 0 30px; border-radius: 30px; border: none;
  background: var(--accent); color: var(--accent-ink); font: inherit; font-size: 19px; font-weight: 700; cursor: pointer; box-shadow: 0 6px 18px rgba(120,80,0,.3); }
.fab:hover { background: var(--accent-hover); }
.fab[hidden] { display: none !important; }

/* ===== スマホ表示の調整 ===== */
/* 内容が短い画面でメニューが縦に伸びないように */
@media (max-width: 700px) {
  .layout { align-content: flex-start; }
  .side { align-content: flex-start; align-items: center; gap: 4px 6px; }
  .menu { padding: 0 12px; }
  /* 上の「日本語/한국어」「ログアウト」は1行に小さく。名前はかくす */
  .top { flex-wrap: nowrap; }
  .top-right { flex-wrap: nowrap; gap: 6px; flex-shrink: 0; }
  .top-right .pill { min-height: 40px; padding: 0 12px; font-size: 14px; white-space: nowrap; }
  .top .who { display: none; }
  h1 { font-size: 24px; }
  /* 財務報告のタブは3つ同じ幅で1行に */
  .tabs-row { flex-direction: column; align-items: stretch; }
  .tabs { display: grid; grid-template-columns: repeat(3, 1fr); }
  .tab { padding: 0 6px; font-size: 16px; }
  .chk { margin-left: 0; }
}
/* 狭い画面では月ボタンの字を少し小さく (「10月」がはみ出さないように) */
@media (max-width: 480px) {
  .mgrid { gap: 4px; }
  .mbtn { font-size: 14px; min-height: 46px; letter-spacing: -0.02em; }
  .per-top .yr { font-size: 20px; min-width: 80px; }
}

/* ===== レシートの写真を見る ===== */
.viewer { position: fixed; inset: 0; z-index: 1100; background: rgba(20, 22, 20, .88); display: flex; flex-direction: column; }
.viewer[hidden] { display: none !important; }
.viewer-top { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 14px; }
.viewer-btn { min-height: 48px; min-width: 48px; padding: 0 18px; border-radius: 24px; border: none; background: rgba(255,255,255,.92);
  color: var(--text); font: inherit; font-size: 17px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; cursor: pointer; }
.viewer-btn.close { font-size: 22px; padding: 0; }
.viewer-body { flex: 1; overflow: auto; display: flex; align-items: center; justify-content: center; padding: 0 12px 16px; touch-action: pinch-zoom pan-x pan-y; }
.viewer-body img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; background: #ffffff; cursor: zoom-in; }
.viewer-body.zoom { align-items: flex-start; justify-content: flex-start; }
.viewer-body.zoom img { max-width: none; max-height: none; cursor: zoom-out; }
.viewer-msg { color: #ffffff; font-size: 18px; text-align: center; white-space: pre-line; }
body.noscroll { overflow: hidden; }

/* ===== スマホだけ: 下のメニュー・「その他」 ===== */
.tabbar, .sheet, .sheet-dim { display: none; }
@media (max-width: 700px) {
  .side { display: none; }                      /* 上のメニューは出さない */
  .top-right #logoutBtn { display: none; }      /* ログアウトは「その他」の中 */
  .main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 800;
    background: #ffffff; border-top: 1px solid var(--line); padding: 6px 4px calc(8px + env(safe-area-inset-bottom)); }
  .tb { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 58px; border-radius: 12px;
    color: var(--sub); text-decoration: none; font: inherit; font-size: 13px; background: none; border: none; cursor: pointer; }
  .tb.on { color: var(--blue); font-weight: 700; background: var(--blue-soft); }
  .sheet-dim:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 850; background: rgba(0,0,0,.28); }
  .sheet:not([hidden]) { display: flex; flex-direction: column; position: fixed; left: 0; right: 0; bottom: 0; z-index: 860; background: #ffffff;
    border-radius: 20px 20px 0 0; box-shadow: 0 -6px 20px rgba(0,0,0,.15); padding: 12px 16px calc(96px + env(safe-area-inset-bottom)); }
  .sheet-handle { width: 42px; height: 5px; border-radius: 3px; background: #d9d1b0; margin: 0 auto 10px; }
  .sheet-it { display: flex; align-items: center; gap: 12px; min-height: 58px; border: none; border-bottom: 1px solid #f0ead2; background: none;
    font: inherit; font-size: 18px; color: var(--text); text-decoration: none; text-align: left; padding: 0 6px; cursor: pointer; }
  .sheet-it.dim { color: #8a8778; }
  .sheet-it .soon { margin-left: auto; font-size: 12px; color: var(--sub); background: #f3f0e2; padding: 2px 8px; border-radius: 8px; }
  #sheetLogout { color: #a3341f; border-bottom: none; }
  .fab { bottom: calc(96px + env(safe-area-inset-bottom)); }    /* 「完了」は下のメニューの上に */
  /* ホーム: カードは2×2、ボタンは「レシートから入力」だけ大きく (ほかは下のメニューにある) */
  .cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card { padding: 14px 16px; }
  .card .num { font-size: 23px; }
  .actions { grid-template-columns: 1fr; }
  .actions .act:not(#actReceipt) { display: none; }
  .act#actReceipt { min-height: 68px; }
}
@media (max-width: 700px) { .tabbar { z-index: 870; } }

/* ===== 要相談・対象外 ===== */
.opt.ask[aria-pressed="true"] { border-color: #e0a800; background: #ffe9a6; color: #5a4300; }
.opt.out[aria-pressed="true"] { border-color: #9a9a90; background: #ecebe6; color: #555; }
.st-note { margin: 8px 0 0; font-size: 15px; color: var(--sub); }
tr.st-ask td { background: #fff4cc; }
tr.st-out td { color: #9a9a90; text-decoration: line-through; }
tr.st-out td.go { color: var(--blue); text-decoration: none; }
.badge { display: inline-block; font-size: 13px; padding: 1px 8px; border-radius: 8px; margin-left: 4px; vertical-align: middle; text-decoration: none; }
.badge.ask { background: #f5b400; color: #3a2c00; }
.badge.out { background: #ddd; color: #555; }
.ask-note { display: block; font-size: 15px; color: #8a6a00; text-align: right; }
.ask-note.rep { text-align: left; margin: 0 0 10px; }
.ask-band { background: #fff4cc; border: 2px solid #f5b400; color: #3a2c00; border-radius: 12px; padding: 12px 16px; margin: 0 0 12px; font-weight: 700; font-size: 17px; }
.st-filter { margin-bottom: 12px; }
.chk.ask-chk { color: #8a6a00; }
.chk.ask-chk + .chk { margin-left: 16px; }
/* 会計用語: 点線の下線 + マウスを乗せると説明 (ツールチップ) */
.term { text-decoration: underline dotted #9a8f60; text-decoration-thickness: 1.5px; text-underline-offset: 4px; cursor: help; }
/* かんたんクラウド用CSVの書き出しボタン */
.export-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0 0 14px; }
.export-row .btn-mini { min-height: 44px; padding: 0 20px; font-size: 17px; }
.export-msg { color: var(--sub); font-size: 16px; }

/* ===== 2026-10-30 画面の整理: ビジネス向けにすっきり (文字の大きさは変えない) ===== */
.box, .card, .signal, .attached, .editband, .confirm { border-radius: 10px; }
.btn { border-radius: 8px; min-height: 52px; }
.btn.danger { border-width: 1px; }
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
input[type="text"], input[type="date"], select { border-radius: 8px; }
select {
  height: 52px; border: 1px solid #d9d1b0; padding: 0 14px; font: inherit; font-size: 18px; color: var(--text);
  background: #ffffff; width: 100%; min-width: 0; cursor: pointer;
}
select:focus-visible { outline: 3px solid #e7c06a; outline-offset: 2px; }

.home-head { display: flex; flex-wrap: wrap; gap: 12px; }
.home-head .btn { flex: none; min-width: 150px; padding: 0 22px; }
.home-head .btn.primary { min-width: 200px; }
.cards { grid-template-columns: repeat(3, 1fr); }
.notice {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px;
  border-radius: 10px; background: #fff6e0; border: 1px solid #f0dca8; color: #7a4a10; font-size: 18px; text-decoration: none;
}
.notice b { color: var(--blue); }
.notice:hover { background: #ffefc6; }
.notice[hidden] { display: none; }

.form-head { display: flex; align-items: center; justify-content: flex-end; gap: 12px 20px; flex-wrap: wrap; }
.form-head[hidden] { display: none; }
.form { flex: 5 1 520px; gap: 18px; }
.side-col { flex: 2 1 260px; }
.rcpt-tools { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; }
.rcpt-tools .btn { flex: none; min-height: 48px; padding: 0 20px; }
.hint-sm { font-size: 15px; color: var(--sub); }
.grid2 { display: grid; grid-template-columns: repeat(6, 1fr); gap: 18px 24px; }
.grid2 .c2 { grid-column: span 2; } .grid2 .c3 { grid-column: span 3; } .grid2 .c4 { grid-column: span 4; }
.grid2 .full, details.more .grid2 .field { grid-column: span 3; }
.grid2 .full { grid-column: 1 / -1; }
.grid2 .field { flex: none; }
.qlinks { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; min-height: 0; }
.qlinks:empty { display: none; }
.ql-lead { font-size: 15px; color: var(--sub); }
.qlink { border: none; background: none; padding: 0; font: inherit; font-size: 16px; line-height: 1.5; color: var(--blue); cursor: pointer; text-decoration: underline; }
.qlink:hover { color: var(--accent-ink); }
details.more { border-top: 1px solid var(--line); padding-top: 14px; }
details.more > summary { cursor: pointer; font-size: 17px; font-weight: 700; color: var(--blue); padding: 6px 0; }
details.more[open] > summary { margin-bottom: 14px; }
.pv-line { margin: 0; padding: 14px 16px; background: var(--blue-soft); border-radius: 8px; font-size: 17px; line-height: 1.6; color: var(--text); }
.attached.add { background: #f3f0e2; color: var(--sub); }
.attached.add .btn { flex: none; min-height: 46px; padding: 0 18px; }
.np-lead { margin: 0 0 14px; font-size: 17px; color: var(--sub); }
@media (max-width: 700px) {
  .grid2 { grid-template-columns: 1fr; gap: 16px; }
  .grid2 .c2, .grid2 .c3, .grid2 .c4, details.more .grid2 .field { grid-column: 1 / -1; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .home-head .btn { flex: 1 1 140px; }
  .home-head .btn.primary { flex: 1 1 100%; min-height: 60px; }
  .form-head { align-items: flex-start; }
}
/* 選択リストの下に余白が出ないように (フォントの高さ計算のずれ対策) */
select, select option { font-family: "Meiryo", "Yu Gothic UI", "Malgun Gothic", system-ui, sans-serif; line-height: 1.4; }
select option { font-size: 17px; padding: 4px 10px; }
