/* ==========================================================================
   経費精算（js/expense.js）。プレビュー docs/expense/preview.html のデザイン：
   色は文字の濃淡と、操作の色・未払のオレンジだけ。飾り（影・色付きの箱・アイコン）は使わない。
   ========================================================================== */
.exp, .exp-modal-bg {
  --exp-ink: var(--c-ink, #1c1a17);
  --exp-ink-2: var(--c-ink-2, #3d3933);
  --exp-muted: var(--c-muted, #736c60);
  --exp-faint: var(--c-faint, #a39c8e);
  --exp-line: var(--c-line, #e4e0d6);
  --exp-line-2: var(--c-line-strong, #d1cbbe);
  --exp-hover: #f8f6f1;
  --exp-unpaid: #9c5d34;
  --exp-ok: #347048;
  --exp-wait: #905630;
  --exp-ng: #a8392b;
  color: var(--exp-ink);
  font-size: 14px;
  line-height: 1.6;
}
.exp h2 { font-size: 15px; font-weight: 600; margin: 0 0 4px; display: flex; align-items: center; gap: 10px; }
.exp-sub { color: var(--exp-muted); font-size: 12.5px; margin: 0 0 16px; }
.exp-muted { color: var(--exp-muted); }
.exp-small { font-size: 12px; }
.exp-grow { flex: 1; }
.exp-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.exp-mt { margin-top: 14px; }
.exp-mb { margin-bottom: 20px; }
.exp-num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.exp-center { text-align: center; }
.exp-mono { font-variant-numeric: tabular-nums; color: var(--exp-muted); font-size: 12px; white-space: nowrap; }
.exp-click { cursor: pointer; }
.exp-hot { color: var(--exp-unpaid); }
.exp-warn-text { color: var(--exp-wait); }
.exp-empty { color: var(--exp-muted); padding: 40px 0; text-align: center; }
.exp-section { margin-top: 44px; }

/* タブ */
.exp-tabs { display: flex; gap: 26px; border-bottom: 1px solid var(--exp-line); margin: 0 0 28px; overflow-x: auto; scrollbar-width: none; padding-top: 2px; }
.exp-tabs::-webkit-scrollbar { display: none; }
.exp-tabs button { border: 0; background: none; padding: 0 0 12px; color: var(--exp-muted); cursor: pointer; white-space: nowrap; border-bottom: 1.5px solid transparent; margin-bottom: -1px; font: inherit; font-size: 13.5px; }
.exp-tabs button:hover { color: var(--exp-ink-2); }
.exp-tabs button.on { color: var(--exp-ink); border-bottom-color: var(--exp-ink); font-weight: 600; }
.exp-tabs sup { font-size: 11px; color: var(--exp-unpaid); font-weight: 600; margin-left: 3px; }

/* ボタン */
.exp-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 6px; border: 1px solid var(--exp-line-2); background: #fff; color: var(--exp-ink); cursor: pointer; white-space: nowrap; font: inherit; font-size: 13px; transition: background .12s; }
.exp-btn:hover { background: var(--exp-hover); }
.exp-btn:disabled { color: var(--exp-faint); cursor: default; background: none; }
.exp-primary { background: var(--exp-ink); border-color: var(--exp-ink); color: #fff; }
.exp-primary:hover { background: #34322e; }
.exp-primary:disabled { background: #eeece9; border-color: #eeece9; color: var(--exp-faint); }
.exp-quiet { border-color: transparent; color: var(--exp-ink-2); background: none; }
.exp-danger { color: var(--exp-ng); }
.exp-danger-fill { background: var(--exp-ng); border-color: var(--exp-ng); color: #fff; }
.exp-danger-fill:hover { background: #82372b; }
.exp-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.exp-lg { height: 48px; font-size: 14.5px; padding: 0 22px; }
.exp-link { color: var(--c-brand, #56693a); background: none; border: 0; padding: 0; cursor: pointer; font: inherit; font-size: 13px; }
.exp-link:hover { text-decoration: underline; }
.exp-ng { color: var(--exp-ng); }

/* 状態：小さな点＋文字 */
.exp-st { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--exp-ink-2); white-space: nowrap; }
.exp-st::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--exp-faint); flex-shrink: 0; }
.exp-st-waiting::before { background: var(--exp-wait); }
.exp-st-returned::before { background: var(--exp-ng); }
.exp-st-unpaid { color: var(--exp-unpaid); font-weight: 600; }
.exp-st-unpaid::before { background: var(--exp-unpaid); }
.exp-st-paid { color: var(--exp-muted); }
.exp-st-paid::before { background: var(--exp-ok); }
.exp-st-rejected, .exp-st-cancelled { color: var(--exp-faint); }
.exp-tag { font-size: 11.5px; color: var(--exp-muted); border: 1px solid var(--exp-line-2); border-radius: 4px; padding: 0 6px; font-weight: 400; }

/* 表 */
.exp-tw { overflow-x: auto; }
.exp-t { width: 100%; border-collapse: collapse; }
.exp-t th { text-align: left; font-size: 12px; color: var(--exp-muted); font-weight: 500; padding: 0 10px 10px; border-bottom: 1px solid var(--exp-line); white-space: nowrap; }
.exp-t td { padding: 12px 10px; border-bottom: 1px solid var(--exp-line); vertical-align: middle; }
.exp-t tr:hover td { background: #fefdfb; }
.exp-t tr.exp-dim td { color: var(--exp-muted); }
.exp-d2 { font-size: 12px; color: var(--exp-muted); }
.exp-thumb { width: 30px; height: 40px; border-radius: 3px; background: #f4f3f1; object-fit: cover; display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; font-size: 9px; color: var(--exp-faint); }
.exp-acts { display: flex; gap: 14px; justify-content: flex-end; align-items: center; }
.exp-inline { border: 1px solid var(--exp-line-2); border-radius: 6px; padding: 5px 8px; background: #fff; font: inherit; font-size: 13px; color: inherit; }
.exp-need { border-color: #c37b4b; }

/* 入力 */
.exp-form { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 16px; }
.exp-full { grid-column: 1 / -1; }
.exp-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.exp-field > label { font-size: 12px; color: var(--exp-muted); }
.exp-field input, .exp-field select, .exp-field textarea, .exp-modal input:not([type="checkbox"]), .exp-modal textarea, .exp-modal select {
  border: 1px solid var(--exp-line-2); border-radius: 6px; padding: 7px 10px; background: #fff; width: 100%; min-height: 36px; outline: none; font: inherit; font-size: 14px; color: inherit; box-sizing: border-box;
}
.exp-field input:focus, .exp-field select:focus, .exp-field textarea:focus { border-color: var(--exp-ink-2); }
.exp-field input:disabled { background: var(--exp-hover); color: var(--exp-ink-2); }
.exp-check input { border-color: #c37b4b; }
.exp-hint { font-size: 12px; color: var(--exp-wait); }
.exp-req { font-size: 11px; color: var(--exp-ng); margin-left: 4px; }
.exp-divider { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--exp-muted); margin-top: 10px; }
.exp-divider::after { content: ""; flex: 1; height: 1px; background: var(--exp-line); }
.exp-pair { display: grid; grid-template-columns: 34px 1fr 1fr; gap: 8px; align-items: center; font-size: 13px; color: var(--exp-muted); }
.exp-pair input { text-align: right; }

/* 取り込み */
.exp-cap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; align-items: start; }
.exp-cap-buttons { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.exp-cap-buttons .exp-btn { flex: 1; min-width: 150px; }
.exp-drop { border: 1px dashed var(--exp-line-2); border-radius: 8px; padding: 30px 20px; text-align: center; color: var(--exp-muted); font-size: 12.5px; margin-bottom: 20px; transition: background .12s; }
.exp-drop b { display: block; color: var(--exp-ink); font-weight: 500; font-size: 14px; margin-bottom: 4px; }
.exp-drop.over { background: var(--c-brand-50, #f4f5ee); border-color: var(--c-brand, #56693a); }
.exp-cap-opts { margin-bottom: 14px; }
.exp-uploads { margin-top: 24px; }
.exp-uploads-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--exp-muted); padding-bottom: 8px; border-bottom: 1px solid var(--exp-line); }
.exp-upload { padding: 10px 0; border-bottom: 1px solid var(--exp-line); font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.exp-upload-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exp-upload-state { color: var(--exp-muted); font-size: 12px; }
.exp-upload.error .exp-upload-state, .exp-upload.error .exp-upload-note { color: var(--exp-ng); }
.exp-upload-note { width: 100%; font-size: 12px; color: var(--exp-wait); }

/* 確認・修正 */
.exp-pager { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; font-size: 13px; flex-wrap: wrap; }
.exp-review { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; align-items: start; }
.exp-paper { background: #f9f8f6; border-radius: 8px; padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 12px; position: sticky; top: 12px; min-height: 240px; }
.exp-big { max-width: 100%; max-height: 72vh; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.06); transition: transform .2s; }
.exp-tools { display: flex; gap: 4px; }
.exp-noimg { color: var(--exp-muted); margin: auto; font-size: 13px; }
.exp-notice { border-left: 2px solid var(--exp-line-2); padding: 2px 0 2px 12px; margin-bottom: 16px; font-size: 13px; color: var(--exp-ink-2); }
.exp-notice .exp-row { margin-top: 6px; }
.exp-notice-warn { border-left-color: var(--exp-wait); }
.exp-notice-ng { border-left-color: var(--exp-ng); color: var(--exp-ng); }
.exp-notice-info { border-left-color: var(--c-brand, #56693a); }
.exp-notice-muted { color: var(--exp-muted); }
.exp-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--exp-line); }
.exp-dl { margin: 0; }
.exp-dl-row { display: grid; grid-template-columns: 110px 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--exp-line); font-size: 13.5px; }
.exp-dl dt { color: var(--exp-muted); font-size: 12.5px; }
.exp-dl dd { margin: 0; }
.exp-history { margin-top: 24px; font-size: 12.5px; }
.exp-history summary { cursor: pointer; color: var(--exp-muted); }
.exp-history ol { list-style: none; padding: 0; margin: 10px 0 0; }
.exp-history li { padding: 5px 0; border-bottom: 1px solid var(--exp-line); display: flex; gap: 10px; flex-wrap: wrap; }

/* 自分の経費 */
.exp-mine { max-width: 520px; }
.exp-tot { display: flex; gap: 36px; margin-bottom: 20px; flex-wrap: wrap; }
.exp-v { font-size: 24px; font-weight: 500; font-variant-numeric: tabular-nums; }
.exp-v small { font-size: 13px; color: var(--exp-muted); margin-left: 2px; font-weight: 400; }
.exp-mi { display: flex; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--exp-line); cursor: pointer; }
.exp-mi:hover { background: #fefdfb; }
.exp-mi .exp-thumb { width: 36px; height: 46px; }
.exp-t1 { font-weight: 500; }
.exp-t2 { font-size: 12px; color: var(--exp-muted); }
.exp-back { font-size: 12px; color: var(--exp-ng); margin-top: 2px; }
.exp-r { text-align: right; }
.exp-amt { font-variant-numeric: tabular-nums; font-weight: 500; }

/* 承認 */
.exp-group { margin-bottom: 40px; }
.exp-ghead { display: flex; align-items: baseline; gap: 14px; padding-bottom: 10px; flex-wrap: wrap; }
.exp-nm { font-size: 15px; font-weight: 600; }

/* 一覧・支払 */
.exp-stats { display: flex; margin-bottom: 28px; border-top: 1px solid var(--exp-line); border-bottom: 1px solid var(--exp-line); }
.exp-stat { flex: 1; padding: 16px 0 16px 22px; border-left: 1px solid var(--exp-line); }
.exp-stat:first-child { border-left: 0; padding-left: 0; }
.exp-l { font-size: 12px; color: var(--exp-muted); }
.exp-c { font-size: 12px; color: var(--exp-muted); }
.exp-stat.exp-hot .exp-v { color: var(--exp-unpaid); }
.exp-filters { display: flex; gap: 20px; align-items: center; margin-bottom: 16px; font-size: 13px; flex-wrap: wrap; color: var(--exp-muted); }
.exp-filters label { display: flex; align-items: center; gap: 8px; }
.exp-filters select { color: var(--exp-ink); }
.exp-seg button { border: 0; background: none; padding: 0; margin-right: 16px; color: var(--exp-muted); cursor: pointer; font: inherit; font-size: 13px; }
.exp-seg button.on { color: var(--exp-ink); font-weight: 600; }
.exp-people { border-top: 1px solid var(--exp-line); }
.exp-person { border-bottom: 1px solid var(--exp-line); }
.exp-prow { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr 200px; gap: 16px; align-items: center; padding: 16px 4px; cursor: pointer; }
.exp-prow:hover { background: #fefdfb; }
.exp-prow .exp-nm { font-weight: 500; font-size: 14px; display: flex; align-items: center; gap: 10px; }
.exp-prow .exp-nm::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid var(--exp-faint); border-bottom: 1.5px solid var(--exp-faint); transform: rotate(-45deg); transition: transform .15s; }
.exp-person.open .exp-prow .exp-nm::before { transform: rotate(45deg); }
.exp-k { font-size: 11.5px; color: var(--exp-muted); }
.exp-cv { font-variant-numeric: tabular-nums; }
.exp-cell.exp-hot .exp-cv { color: var(--exp-unpaid); font-weight: 600; }
.exp-cell.exp-none .exp-cv { color: var(--exp-faint); }
.exp-go { text-align: right; }
.exp-pdetail { display: none; padding: 0 0 20px 20px; }
.exp-person.open .exp-pdetail { display: block; }
.exp-person-title { font-size: 17px !important; margin-bottom: 16px !important; }

/* 月末・帳票 */
.exp-month { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 56px; align-items: start; }
.exp-check { list-style: none; margin: 0 0 40px; padding: 0; counter-reset: s; }
.exp-check li { display: grid; grid-template-columns: 24px 1fr auto; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--exp-line); align-items: start; counter-increment: s; }
.exp-check li::before { content: counter(s); font-size: 12px; color: var(--exp-muted); padding-top: 1px; }
.exp-check li b { font-weight: 500; }
.exp-check li.exp-todo b { color: var(--exp-wait); }
.exp-files { list-style: none; margin: 0; padding: 0; }
.exp-files li { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--exp-line); font-size: 13.5px; }
.exp-files li span { color: var(--exp-muted); font-size: 12px; margin-left: 10px; }

/* 原本 */
.exp-envs { border-top: 1px solid var(--exp-line); }
.exp-env { display: grid; grid-template-columns: 140px 1fr 150px 200px; gap: 20px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--exp-line); }
.exp-env.on .exp-env-name { font-weight: 600; color: var(--exp-ink); }
.exp-env-name { text-align: left; }
.exp-meter { height: 3px; background: var(--exp-line); border-radius: 2px; overflow: hidden; }
.exp-meter b { display: block; height: 100%; background: var(--exp-ink); }

/* 検索 */
.exp-search { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; align-items: end; margin-bottom: 24px; }
.exp-search > .exp-btn { justify-self: start; min-width: 120px; }
.exp-rng { display: flex; gap: 6px; align-items: center; color: var(--exp-muted); }
.exp-rng input { flex: 1; min-width: 0; }
.exp-okline { display: flex; align-items: center; gap: 20px; font-size: 13.5px; padding: 16px 0; border-top: 1px solid var(--exp-line); border-bottom: 1px solid var(--exp-line); }
.exp-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--exp-ok); flex-shrink: 0; }
.exp-ngline .exp-dot { background: var(--exp-ng); }
.exp-ngline ul { margin: 8px 0 0; padding-left: 18px; color: var(--exp-ng); font-size: 12.5px; }
.exp-settings input:not([type="checkbox"]) { border: 1px solid var(--exp-line-2); border-radius: 6px; padding: 5px 8px; width: 100%; font: inherit; font-size: 13px; }

/* 小窓・知らせ（body の直下に出すので .exp の外） */
.exp-modal-bg { position: fixed; inset: 0; background: rgba(28, 26, 23,.32); display: flex; align-items: center; justify-content: center; z-index: 2000; padding: 16px; }
.exp-modal { background: #fff; border-radius: 10px; width: 440px; max-width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: 0 24px 60px -12px rgba(0,0,0,.25); padding: 24px 24px 18px; color: var(--c-ink, #1c1a17); font-size: 13.5px; }
.exp-modal h3 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.exp-modal-body { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; color: var(--c-ink-2, #3d3933); }
.exp-modal-body p { margin: 0; }
.exp-modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.exp-modal .exp-field { display: flex; flex-direction: column; gap: 6px; }
.exp-modal .exp-field > label { font-size: 12px; color: var(--c-muted, #736c60); }
.exp-modal .exp-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.exp-modal .exp-btn, .exp-modal .exp-link { font-family: inherit; }
.exp-modal label.exp-small { display: flex; align-items: center; gap: 8px; }
.exp-modal-bg .exp-btn { display: inline-flex; align-items: center; justify-content: center; height: 34px; padding: 0 14px; border-radius: 6px; border: 1px solid #d1cbbe; background: #fff; color: #1c1a17; cursor: pointer; font-size: 13px; }
.exp-modal-bg .exp-primary { background: #1c1a17; border-color: #1c1a17; color: #fff; }
.exp-modal-bg .exp-danger-fill { background: #a8392b; border-color: #a8392b; color: #fff; }
.exp-modal-bg .exp-quiet { border-color: transparent; background: none; }
.exp-modal-bg .exp-danger { color: #a8392b; }
.exp-modal-bg .exp-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.exp-modal-bg .exp-row { display: flex; gap: 8px; align-items: center; }
.exp-modal-bg .exp-grow { flex: 1; }
.exp-modal-bg .exp-muted { color: #736c60; }
.exp-modal-bg .exp-small { font-size: 12px; }
.exp-choices { display: flex; gap: 6px; flex-wrap: wrap; }
.exp-choices button { border: 1px solid #d1cbbe; background: #fff; border-radius: 6px; padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.exp-choices button.on { border-color: #1c1a17; font-weight: 600; }
.exp-lines .exp-lr { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #e4e0d6; font-size: 13px; font-variant-numeric: tabular-nums; }
.exp-lines .exp-tot-line { border-bottom: 0; font-weight: 600; font-size: 15px; padding-top: 10px; }
.exp-purge summary { cursor: pointer; font-size: 12.5px; color: #736c60; }
.exp-purge p { font-size: 12.5px; margin: 10px 0; }
.exp-toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(8px); background: #1c1a17; color: #fff; padding: 9px 16px; border-radius: 6px; font-size: 13px; opacity: 0; transition: .2s; pointer-events: none; z-index: 3000; max-width: calc(100vw - 32px); }
.exp-toast.on { opacity: 1; transform: translateX(-50%); }
.exp-toast-error { background: #a8392b; }

@media (max-width: 1100px) {
  .exp-cap, .exp-review, .exp-month { grid-template-columns: 1fr; gap: 36px; }
  .exp-paper { position: static; }
}
@media (max-width: 760px) {
  .exp-form, .exp-search, .exp-modal .exp-form { grid-template-columns: 1fr; }
  .exp-stats { flex-wrap: wrap; }
  .exp-stat { flex: 1 1 45%; padding-left: 0; border-left: 0; }
  .exp-prow { grid-template-columns: 1fr 1fr; }
  .exp-prow .exp-cell:nth-child(3), .exp-prow .exp-cell:nth-child(4) { display: none; }
  .exp-go { grid-column: 1 / -1; text-align: left; }
  .exp-env { grid-template-columns: 1fr 1fr; }
  .exp-cap-buttons .exp-btn { width: 100%; }
}
