/* =====================================================================
   通信工事部 収支管理 Ver.1.0
   Design: ink navy × signal orange
   ===================================================================== */
:root {
  --ink: #0d1726;
  --ink-2: #16233a;
  --ink-3: #22324f;
  --line: #e3e7ee;
  --line-2: #cfd6e2;
  --bg: #f3f5f8;
  --card: #ffffff;
  --text: #172033;
  --muted: #637087;
  --signal: #ff6a13;
  --signal-2: #ff9a3d;
  --signal-soft: #fff1e6;
  --pos: #0f8a5f;
  --pos-soft: #e5f6ef;
  --neg: #d23b3b;
  --neg-soft: #fdecec;
  --warn: #b26a00;
  --warn-soft: #fff6dd;
  --run: #ff6a13;
  --idle: #5b6b85;
  --done: #2f7d5b;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(13, 23, 38, .05), 0 6px 20px rgba(13, 23, 38, .06);
  --font: "Noto Sans JP", system-ui, -apple-system, "Hiragino Sans", "Yu Gothic UI", Meiryo, sans-serif;
  --num: "Inter Tight", "Noto Sans JP", system-ui, sans-serif;
  --sidebar: 232px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--text); background: var(--bg); font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.num { font-family: var(--num); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid rgba(255, 106, 19, .45); outline-offset: 2px; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 28px;
  background: radial-gradient(120% 60% at 0% 0%, #1d2d4a 0%, var(--ink) 60%); color: #dfe6f2; padding: 22px 14px;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px; }
.brand__mark { width: 38px; height: 38px; color: var(--signal); background: rgba(255, 106, 19, .12); border-radius: 11px; padding: 6px; flex: none; }
.brand__corp { display: block; font-family: var(--num); font-weight: 800; letter-spacing: .06em; font-size: 12px; color: var(--signal-2); }
.brand__name { display: block; font-weight: 700; font-size: 14px; line-height: 1.35; color: #fff; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 11px; text-decoration: none;
  font-weight: 500; color: #b9c4d6; position: relative; transition: background .15s, color .15s;
}
.nav a svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; flex: none; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.is-active { background: linear-gradient(90deg, rgba(255, 106, 19, .22), rgba(255, 106, 19, .06)); color: #fff; font-weight: 700; }
.nav a.is-active::before { content: ""; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--signal); }
.nav a.is-active svg { color: var(--signal-2); }
.sidebar__foot { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .08); padding: 16px 8px 0; display: grid; gap: 10px; }
.me { display: flex; align-items: center; gap: 10px; }
.me__avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--signal); color: #fff; font-weight: 700; }
.me__name { font-weight: 700; color: #fff; font-size: 14px; }
.sidebar__links { display: grid; gap: 2px; font-size: 13px; }
.sidebar__links form { margin: 0; }
.sidebar__links a, .sidebar__links button { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: 0; padding: 7px 8px; border-radius: 8px; color: #93a1b8; cursor: pointer; text-decoration: none; font: inherit; font-size: 13px; text-align: left; }
.sidebar__links svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidebar__links a:hover, .sidebar__links button:hover { color: #fff; background: rgba(255,255,255,.06); }
.sidebar__links a.is-active { color: #fff; background: rgba(255,255,255,.08); }
.main { padding: 28px 34px 60px; min-width: 0; outline: none; }
.loading { padding: 60px; text-align: center; color: var(--muted); }

/* ---------- Page head ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 26px; font-weight: 900; letter-spacing: .02em; display: flex; align-items: center; gap: 12px; }
.page-head h1::before { content: ""; width: 6px; height: 26px; border-radius: 3px; background: linear-gradient(var(--signal), var(--signal-2)); }
.page-head .lead { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.greet { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.greet b { color: var(--text); }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card__title { margin: 0; font-size: 17px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.card__body { padding: 18px 20px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { position: relative; overflow: hidden; padding: 18px 20px 20px; }
.kpi__label { font-size: 13px; font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.kpi__icon { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--bg); }
.kpi__icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.kpi__value { font-family: var(--num); font-weight: 800; font-size: 34px; line-height: 1.15; margin-top: 10px; letter-spacing: -.02em; white-space: nowrap; }
.kpi__value small { font-family: var(--font); font-size: 15px; font-weight: 700; margin-left: 3px; color: var(--muted); }
.kpi__sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi--profit { background: linear-gradient(135deg, #fff6ef 0%, #ffe4d0 100%); border-color: #ffd2b0; }
.kpi--profit .kpi__label { color: var(--muted); }
.kpi--profit .kpi__sub { color: var(--muted); }
.kpi--profit .kpi__icon { background: #fff; color: var(--signal); box-shadow: 0 1px 3px rgba(255, 106, 19, .2); }
.kpi--profit::after { content: ""; position: absolute; right: -30px; top: -30px; width: 130px; height: 130px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .8), transparent 70%); pointer-events: none; }
.kpi--profit.is-neg { background: linear-gradient(135deg, #fff3f3, #ffdede); border-color: #f5bcbc; }
.kpi--profit.is-neg .kpi__value { color: var(--neg); }
.kpi--profit.is-neg .kpi__label, .kpi--profit.is-neg .kpi__sub { color: var(--neg); }

/* ---------- Period (弥生会計方式) ---------- */
.period { padding: 14px 16px; }
.period__value { font-family: var(--num); font-weight: 700; font-size: 15px; }
.yp { min-width: 560px; display: grid; gap: 10px; position: relative; }
.yp__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.yp__year { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; color: var(--muted); }
.yp__nav { border: 1.5px solid var(--line-2); background: #fff; border-radius: 7px; width: 28px; height: 28px; cursor: pointer; color: var(--signal); font-size: 11px; }
.yp__nav:hover { border-color: var(--signal); }
.yp__nav:disabled { opacity: .35; cursor: default; }
.yp__bar { display: flex; align-items: stretch; gap: 8px; }
.yp__btn { border: 1.5px solid var(--line-2); background: #fff; border-radius: 9px; padding: 0 12px; font-weight: 700; font-size: 13px; cursor: pointer; white-space: nowrap; min-height: 38px; }
.yp__btn:hover { border-color: var(--ink-3); }
.yp__btn.is-on { background: var(--ink); color: #fff; border-color: var(--ink); }
.yp__months { flex: 1; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); border: 1.5px solid var(--line-2); border-radius: 9px; overflow: hidden; touch-action: none; user-select: none; background: #fff; }
.yp__m { border: 0; border-left: 1px solid var(--line); background: transparent; min-height: 38px; padding: 0; font-family: var(--num); font-weight: 700; font-size: 14px; cursor: pointer; position: relative; color: var(--text); }
.yp__m:first-child { border-left: 0; }
.yp__m:hover { background: #fff6ef; }
.yp__m.is-on { background: #ffd8c2; color: #a63e00; border-left-color: #ffc3a1; }
.yp__m.is-first, .yp__m.is-last { background: var(--signal); color: #fff; }
.yp__m.is-now::after { content: ""; position: absolute; left: 50%; bottom: 4px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: currentColor; opacity: .7; }
.yp__pop { position: absolute; right: 16px; top: calc(100% + 6px); z-index: 20; display: flex; gap: 8px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; box-shadow: 0 12px 30px rgba(13, 23, 38, .18); }
.yp__pop[hidden] { display: none; }
.yp__pop .select { width: 140px; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; }
.field__label { font-size: 13px; font-weight: 700; color: #34405a; }
.req { color: var(--neg); margin-left: 3px; font-weight: 900; }
.req-tag { font-size: 11px; color: var(--neg); background: var(--neg-soft); border-radius: 4px; padding: 1px 6px; margin-left: 6px; font-weight: 700; }
.opt-tag { font-size: 11px; color: var(--muted); background: var(--bg); border-radius: 4px; padding: 1px 6px; margin-left: 6px; font-weight: 500; }
.input, .select, .textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1.5px solid var(--line-2); border-radius: var(--radius-sm);
  background: #fff; transition: border-color .15s, box-shadow .15s; min-width: 0;
}
.select { appearance: none; padding-right: 34px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23637087' stroke-width='1.8'/%3E%3C/svg%3E") no-repeat right 12px center / 12px; }
.textarea { min-height: 96px; resize: vertical; }
.input:hover, .select:hover, .textarea:hover { border-color: #aeb8c9; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--signal); box-shadow: 0 0 0 4px rgba(255, 106, 19, .14); outline: none; }
.input[readonly], .input:disabled, .select:disabled { background: repeating-linear-gradient(-45deg, #f4f6f9 0 6px, #eef1f5 6px 12px); color: var(--muted); border-style: dashed; cursor: not-allowed; }
.input--num { text-align: right; font-family: var(--num); font-variant-numeric: tabular-nums; }
.has-error .input, .has-error .select, .has-error .textarea, .has-error .chips-input { border-color: var(--neg); background: #fffafa; }
.err { color: var(--neg); font-size: 12.5px; font-weight: 700; display: flex; gap: 4px; align-items: center; }
.err::before { content: "!"; display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: var(--neg); color: #fff; font-size: 10px; }
.hint { font-size: 12px; color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--signal); }

.form-grid { display: grid; grid-template-columns: 190px 1fr; border-top: 1px solid var(--line); }
.form-grid > .fl { padding: 16px 18px; background: #fafbfc; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 14px; display: flex; align-items: center; flex-wrap: wrap; }
.form-grid > .fv { padding: 12px 18px; border-bottom: 1px solid var(--line); display: grid; gap: 6px; align-content: center; min-width: 0; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1 1 220px; min-width: 0; }

/* segmented / pill radios */
.seg { display: inline-flex; flex-wrap: wrap; gap: 8px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border: 1.5px solid var(--line-2); border-radius: 999px;
  cursor: pointer; font-weight: 700; font-size: 14px; background: #fff; transition: all .15s;
}
.seg label::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-2); background: #fff; transition: all .15s; flex: none; }
.seg input:checked + label { border-color: var(--signal); background: var(--signal-soft); color: #b84300; }
.seg input:checked + label::before { border-color: var(--signal); background: radial-gradient(circle, var(--signal) 45%, #fff 50%); }
.seg input:focus-visible + label { outline: 3px solid rgba(255, 106, 19, .45); outline-offset: 2px; }
.seg--check label::before { border-radius: 4px; }
.seg--check input:checked + label::before { background: var(--signal) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath d='M1 5l3.5 3.5L11 1' fill='none' stroke='white' stroke-width='2'/%3E%3C/svg%3E") no-repeat center / 9px; }

/* chips multi-select */
.chips-input { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 42px; padding: 5px 8px; border: 1.5px solid var(--line-2); border-radius: var(--radius-sm); background: #fff; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px 4px 12px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 13px; font-weight: 500; }
.chip button { border: 0; background: rgba(255, 255, 255, .15); color: #fff; width: 22px; height: 22px; border-radius: 50%; cursor: pointer; line-height: 1; }
.chip.is-stopped { background: #7a8496; }
.chips-input select { border: 0; flex: 1 1 160px; min-height: 30px; outline: none; background: transparent; padding: 0 6px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border-radius: 10px;
  border: 1.5px solid var(--line-2); background: #fff; font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap; transition: all .15s;
}
.btn:hover { border-color: var(--ink-3); }
.btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.btn--primary { background: linear-gradient(135deg, var(--signal), #ff8a2a); border-color: transparent; color: #fff; box-shadow: 0 6px 16px rgba(255, 106, 19, .32); }
.btn--primary:hover { filter: brightness(1.05); transform: translateY(-1px); box-shadow: 0 8px 20px rgba(255, 106, 19, .38); }
.btn--dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn--ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn--ghost:hover { background: var(--bg); color: var(--text); border-color: transparent; }
.btn--danger { color: var(--neg); border-color: #f2c4c4; }
.btn--lg { min-height: 50px; padding: 12px 28px; font-size: 16px; border-radius: 12px; }
.btn--sm { min-height: 32px; padding: 4px 12px; font-size: 13px; border-radius: 8px; }
.btn--icon { width: 34px; min-height: 34px; padding: 0; border-radius: 8px; }
.btn--block { width: 100%; }
.btn[disabled], .btn.is-busy { opacity: .6; pointer-events: none; }
.btn.is-busy::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; white-space: nowrap; border: 1.5px solid transparent; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge--in_progress { color: #c24e00; background: var(--signal-soft); border-color: #ffd2b0; }
.badge--in_progress::before { animation: pulse 1.6s infinite; }
.badge--not_started { color: var(--idle); background: #eef1f6; border-color: #dce2ec; }
.badge--not_started::before { background: transparent; border: 2px solid currentColor; width: 5px; height: 5px; }
.badge--completed { color: var(--done); background: var(--pos-soft); border-color: #bfe5d3; }
.badge--completed::before { content: "✓"; background: none; width: auto; height: auto; font-size: 11px; }
.badge--stopped { color: #7a8496; background: #eef0f3; border-color: #dde1e7; }
.badge--active { color: var(--pos); background: var(--pos-soft); border-color: #bfe5d3; }
.badge--role { color: #34405a; background: #eef1f6; border: 0; }
.badge--role::before { display: none; }
.badge--pending { color: var(--warn); background: var(--warn-soft); border-color: #f3dc9e; }
.badge--pending::before { content: "…"; background: none; width: auto; height: auto; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 700; padding: 11px 14px; background: #f8f9fb; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr.is-click { cursor: pointer; }
.table tbody tr.is-click:hover { background: #fbfcfd; }
.table tbody tr.is-selected { background: var(--signal-soft); }
.table .r { text-align: right; }
.table .c { text-align: center; }
.pname { font-weight: 700; text-decoration: none; color: var(--text); display: inline-flex; flex-direction: column; }
.pname:hover .pname__main { color: var(--signal); text-decoration: underline; }
.pname__code { font-family: var(--num); font-size: 11.5px; color: var(--muted); font-weight: 600; }
.money { font-family: var(--num); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.money.is-neg { color: var(--neg); }
.money small { font-family: var(--font); font-size: 11px; margin-left: 1px; color: var(--muted); font-weight: 500; }
.tag-mini { display: inline-block; font-size: 11px; font-weight: 700; color: var(--warn); background: var(--warn-soft); padding: 1px 7px; border-radius: 4px; margin-top: 2px; }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* ---------- Filters ---------- */
.filters { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.filters .field { min-width: 150px; }
.filters .field--kw { flex: 1 1 220px; }
.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); stroke: var(--muted); fill: none; stroke-width: 2; }
.search .input { padding-left: 38px; }
.count { font-size: 13px; color: var(--muted); margin-left: auto; align-self: center; }

/* ---------- Vendors layout ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(340px, 1fr); gap: 20px; align-items: start; }
.sticky { position: sticky; top: 20px; }
.form-stack { display: grid; gap: 16px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex-wrap: wrap; padding-top: 6px; }
.mode-pill { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--signal-soft); color: #b84300; }
.mode-pill--edit { background: #e8eefb; color: #2b4c9b; }

/* ---------- Project form ---------- */
.idbox { display: flex; flex-direction: column; justify-content: center; padding: 6px 14px; border: 1.5px dashed var(--signal); border-radius: 10px; background: var(--signal-soft); min-width: 150px; flex: none; }
.idbox__label { font-size: 10.5px; font-weight: 700; color: #b84300; display: flex; justify-content: space-between; gap: 10px; }
.idbox__value { font-family: var(--num); font-weight: 800; font-size: 17px; letter-spacing: .02em; }
.callout { display: flex; gap: 12px; padding: 12px 16px; border-radius: 10px; background: var(--warn-soft); border: 1px solid #f3dc9e; font-size: 13.5px; }
.callout--info { background: #eef4ff; border-color: #cfdcf7; }
.callout--ok { background: var(--pos-soft); border-color: #bfe5d3; }
.callout svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; }
.save-bar { display: flex; justify-content: center; gap: 12px; margin-top: 22px; flex-wrap: wrap; }

/* ---------- Entries ---------- */
.ctx { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; padding: 14px 20px; margin-bottom: 18px; }
.ctx__item { display: flex; flex-direction: column; min-width: 0; }
.ctx__k { font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: .04em; }
.ctx__v { font-weight: 700; }
.ctx__v.code { font-family: var(--num); }
.ctx__picker { flex: 1 1 260px; }
.month-step { display: inline-flex; align-items: center; border: 1.5px solid var(--signal); border-radius: 11px; overflow: hidden; margin-left: auto; background: #fff; }
.month-step button { border: 0; background: transparent; width: 40px; height: 42px; cursor: pointer; color: var(--signal); font-size: 15px; }
.month-step button:hover { background: var(--signal-soft); }
.month-step span { font-family: var(--num); font-weight: 800; font-size: 17px; padding: 0 10px; min-width: 120px; text-align: center; }
.ledgers { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 18px; align-items: start; }
.ledger .card__title .dot { width: 12px; height: 12px; }
.ledger--rev .card__head { border-top: 4px solid var(--pos); border-radius: var(--radius) var(--radius) 0 0; }
.ledger--exp .card__head { border-top: 4px solid var(--signal); border-radius: var(--radius) var(--radius) 0 0; }
.ledger__sum { font-family: var(--num); font-weight: 800; font-size: 18px; }
.ledger .table td { padding: 10px 12px; }
.ledger .table th { padding: 10px 12px; }
.ledger tr.is-editing td { background: #fffaf5; vertical-align: top; }
.cell-stack { display: grid; gap: 6px; }
.calc { display: flex; align-items: center; gap: 6px; }
.calc .input { min-width: 0; }
.calc span { color: var(--muted); font-weight: 700; flex: none; }
.ledger__foot { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.sub-line { font-size: 12px; color: var(--muted); display: block; }

.notice { margin-bottom: 14px; }

/* ---------- Detail ---------- */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 18px; align-items: start; }
.dl { display: grid; grid-template-columns: 110px 1fr; margin: 0; }
.dl dt { padding: 10px 0; color: var(--muted); font-size: 13px; font-weight: 700; border-bottom: 1px solid var(--line); }
.dl dd { margin: 0; padding: 10px 0; border-bottom: 1px solid var(--line); font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.title-xl { font-size: 24px; font-weight: 900; margin: 0; line-height: 1.3; }
.title-xl .sub { font-size: 16px; color: var(--muted); font-weight: 700; margin-left: 8px; }

/* ---------- Toast / Modal ---------- */
.toast-wrap { position: fixed; right: 22px; bottom: 22px; display: grid; gap: 10px; z-index: 60; }
.toast { display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 420px; padding: 13px 18px; border-radius: 12px; background: var(--ink); color: #fff; box-shadow: 0 12px 30px rgba(13, 23, 38, .3); font-weight: 700; animation: toastIn .3s cubic-bezier(.2, .8, .2, 1); }
.toast__icon { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--pos); flex: none; font-size: 14px; }
.toast--error .toast__icon { background: var(--neg); }
.toast.is-out { opacity: 0; transform: translateY(8px); transition: all .25s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.modal-back { position: fixed; inset: 0; background: rgba(13, 23, 38, .5); display: grid; place-items: center; padding: 20px; z-index: 70; animation: fade .2s; }
.modal { background: #fff; border-radius: 16px; width: min(560px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 30px 60px rgba(0, 0, 0, .3); }
.modal__head { padding: 20px 24px 6px; display: flex; gap: 12px; align-items: center; }
.modal__head h2 { margin: 0; font-size: 18px; }
.modal__icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--warn-soft); color: var(--warn); font-weight: 900; font-size: 20px; flex: none; }
.modal__body { padding: 8px 24px 16px; }
.modal__foot { padding: 14px 24px 20px; display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login__visual { position: relative; overflow: hidden; background: radial-gradient(100% 80% at 20% 10%, #22365a, var(--ink)); color: #fff; display: flex; align-items: flex-end; padding: 48px; }
.login__waves { position: absolute; right: -80px; top: -60px; width: 520px; color: var(--signal); }
.login__catch { position: relative; display: grid; gap: 10px; }
.login__catch strong { font-size: 40px; line-height: 1.3; font-weight: 900; }
.login__catch span { color: #b9c4d6; }
.login__brand { font-family: var(--num); letter-spacing: .08em; font-size: 18px; font-weight: 800; color: var(--signal-2) !important; }
.login__card { align-self: center; justify-self: center; width: min(400px, 90%); display: grid; gap: 16px; }
.login__card h1 { margin: 0; font-size: 24px; font-weight: 900; }
.login__card .muted { margin: -10px 0 4px; }
.alert { margin: 0; padding: 10px 14px; border-radius: 10px; font-size: 14px; font-weight: 700; }
.alert--error { background: var(--neg-soft); color: var(--neg); }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .kpi__value { font-size: 28px; }
  .ledgers { grid-template-columns: 1fr; }
}
@media (max-width: 1080px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .detail-grid { grid-template-columns: 1fr; }
  .sticky { position: static; }
  .period, .yp { min-width: 0; width: 100%; }
}
@media (max-width: 760px) {
  body { font-size: 15px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 50; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); gap: 0; background: var(--ink); }
  .brand, .sidebar__foot { display: none; }
  .nav { flex-direction: row; width: 100%; gap: 2px; }
  .nav a { flex: 1; flex-direction: column; gap: 3px; padding: 7px 2px; font-size: 11px; text-align: center; border-radius: 10px; }
  .nav a.is-active::before { left: 30%; right: 30%; top: -6px; bottom: auto; width: auto; height: 3px; border-radius: 0 0 3px 3px; }
  .main { padding: 18px 14px 110px; }
  .mobile-top { display: flex !important; }
  .page-head h1 { font-size: 21px; }
  .kpis { gap: 10px; }
  .kpi { padding: 14px; }
  .kpi__value { font-size: 23px; }
      .form-grid { grid-template-columns: 1fr; }
  .form-grid > .fl { padding: 12px 14px 4px; border-bottom: 0; background: #fff; }
  .form-grid > .fv { padding: 4px 14px 14px; }
  .idbox { width: 100%; }
  .filters .field { min-width: 0; flex: 1 1 45%; }
  .table--cards thead { display: none; }
  .table--cards, .table--cards tbody, .table--cards tr, .table--cards td { display: block; width: 100%; }
  .table--cards tr { padding: 12px 14px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; }
  .table--cards td { padding: 0; border: 0; }
  .table--cards td[data-k]::before { content: attr(data-k) "："; color: var(--muted); font-size: 12px; }
  .table--cards td.tc-main { grid-column: 1 / -1; }
  .table--cards td.r { text-align: right; }
  .ledger .table--cards tr.is-editing { grid-template-columns: 1fr; }
  .ledger .table--cards tr.is-editing td::before { display: block; font-weight: 700; margin-bottom: 2px; }
  .month-step { margin-left: 0; }
  .yp__bar { flex-wrap: wrap; }
  .yp__months { order: 3; flex-basis: 100%; }
  .yp__btn { flex: 1; }
  .yp__m { font-size: 13px; min-height: 40px; }
  .yp__pop { left: 0; right: 0; flex-wrap: wrap; }
  .yp__pop .select { flex: 1; width: auto; }
  .toast-wrap { left: 12px; right: 12px; bottom: 84px; }
  .login { grid-template-columns: 1fr; }
  .login__visual { min-height: 200px; padding: 28px; }
  .login__catch strong { font-size: 26px; }
  .dl { grid-template-columns: 90px 1fr; }
}
.mobile-top { display: none; justify-content: space-between; align-items: center; margin: -4px 0 12px; font-size: 13px; color: var(--muted); }
.mobile-top__links { display: flex; align-items: center; gap: 14px; }
.mobile-top__links form { margin: 0; }
.mobile-top__links a, .mobile-top__links button { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; font-size: 13px; text-decoration: none; cursor: pointer; }
.mobile-top__links a:hover, .mobile-top__links button:hover { color: var(--ink, #172033); }
.mobile-top__links .js-nav-reset[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Ledger edit panel ---------- */
.ledger .table td:first-child, .ledger .table th:first-child { white-space: nowrap; width: 1%; }
.ledger .table td.r, .ledger .table th.r { white-space: nowrap; width: 1%; }
.ledger .table td:last-child { width: 1%; padding-left: 0; }
.ledger td.tc-main { min-width: 150px; }
.ledger .row-actions .btn--icon { width: 30px; min-height: 30px; }
.ledger tr.is-editing > td { padding: 0 !important; background: #fffaf5; }
.edit-panel { padding: 16px; border-left: 4px solid var(--signal); display: grid; gap: 14px; }
.ledger--rev .edit-panel { border-left-color: var(--pos); }
.edit-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.edit-grid > .field { grid-column: span 2; min-width: 0; }
.edit-grid > .span-2 { grid-column: span 4; }
.edit-grid > .span-3 { grid-column: span 6; }
.edit-grid > .half { grid-column: span 3; }
.ledger--rev .edit-grid > .span-3 { grid-column: span 6; }
.calc-result { text-align: right; font-size: 15px; margin-top: 2px; }
.calc-result .money { font-size: 18px; }
.edit-actions { display: flex; justify-content: flex-end; gap: 8px; }
.amt .calc { max-width: 440px; }
@media (max-width: 760px) {
  .edit-grid { grid-template-columns: 1fr; }
  .edit-grid > .field, .edit-grid > .span-2, .edit-grid > .span-3, .edit-grid > .half { grid-column: 1 / -1; }
  .ledger .table--cards tr.is-editing { display: block; padding: 0; }
  .ledger .table--cards tr.is-editing td { display: block; }
  .ledger .table--cards td:first-child, .ledger .table--cards td.r, .ledger .table--cards td:last-child { width: auto; }
}

/* ---------- Approval / Lock ---------- */
.nav__badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--signal); color: #fff; font-size: 12px; font-family: var(--num); display: grid; place-items: center; }
.nav__badge[hidden] { display: none; }
.lockbar { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 12px; margin-bottom: 16px; border: 1.5px solid; flex-wrap: wrap; }
.lockbar__icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.lockbar__icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lockbar__text { flex: 1 1 280px; font-size: 14px; }
.lockbar__text b { display: block; font-size: 15px; }
.lockbar__text .sub-line { font-size: 12.5px; }
.lockbar--locked { background: #f4f6f9; border-color: #d6dce6; }
.lockbar--locked .lockbar__icon { background: var(--ink); color: #fff; }
.lockbar--pending { background: var(--warn-soft); border-color: #f3dc9e; }
.lockbar--pending .lockbar__icon { background: #f5b100; color: #fff; }
.lockbar--rejected { background: var(--neg-soft); border-color: #f2c4c4; }
.lockbar--rejected .lockbar__icon { background: var(--neg); color: #fff; }
.lockbar--open { background: var(--pos-soft); border-color: #bfe5d3; }
.lockbar--open .lockbar__icon { background: var(--pos); color: #fff; }
.is-locked .fv, .is-locked .seg label, .is-locked .chips-input { pointer-events: none; }
.is-locked .input, .is-locked .select, .is-locked .textarea, .is-locked .chips-input { background: repeating-linear-gradient(-45deg, #f6f7f9 0 6px, #f0f2f5 6px 12px); border-style: dashed; color: #4b566b; }
.is-locked .seg label { opacity: .75; }
.appr-card { padding: 18px 20px; display: grid; gap: 12px; }
.appr-card + .appr-card { border-top: 1px solid var(--line); }
.appr-card__head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.appr-card__reason { background: #f8f9fb; border-left: 4px solid var(--signal); border-radius: 8px; padding: 10px 14px; white-space: pre-wrap; }
.appr-card__meta { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.appr-card__meta b { color: var(--text); font-family: var(--num); }
.rate-input { display: flex; align-items: center; gap: 8px; max-width: 280px; }
.rate-input span { white-space: nowrap; color: var(--muted); font-weight: 700; }
@media (max-width: 760px) { .nav__badge { position: absolute; top: 2px; right: 18%; min-width: 18px; height: 18px; font-size: 10px; padding: 0 5px; } }

/* ---------- 収支入力: 下段固定の合計バー ---------- */
.summary {
  margin-top: 16px; display: flex; align-items: stretch; gap: 16px; padding: 12px 12px 12px 22px;
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 -2px 0 rgba(13, 23, 38, .02), 0 14px 34px rgba(13, 23, 38, .12);
  position: sticky; bottom: 14px; z-index: 5;
}
.summary::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; border-radius: 16px 16px 0 0; background: linear-gradient(90deg, var(--pos) 0%, var(--pos) 30%, var(--signal) 55%, var(--signal-2) 100%); }
.sum__flow { display: flex; align-items: center; gap: 36px; flex-wrap: wrap; padding: 4px 0; }
.sum__k { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.sum__k .dot { width: 8px; height: 8px; }
.sum__item b { font-family: var(--num); font-size: 24px; font-weight: 800; letter-spacing: -.01em; white-space: nowrap; }
.sum__item b small, .sum__pmain b small, .sum__rate b small { font-family: var(--font); font-size: 13px; font-weight: 700; color: var(--muted); margin-left: 2px; }
.sum__note { display: block; font-size: 11.5px; color: var(--warn); font-weight: 700; }
.sum__profit {
  margin-left: auto; display: flex; align-items: center; gap: 20px; padding: 10px 14px 10px 22px; border-radius: 12px;
  background: linear-gradient(120deg, #fff4ec 0%, #ffe3cf 100%); border: 1px solid #ffd2b0;
}
.sum__pmain { text-align: right; }
.sum__pmain .sum__k { justify-content: flex-end; color: #b84300; }
.sum__pmain b { display: block; font-family: var(--num); font-size: 40px; font-weight: 800; line-height: 1.05; letter-spacing: -.02em; white-space: nowrap;
  background: linear-gradient(135deg, #e85300, #ff8a2a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sum__pmain b small { -webkit-text-fill-color: #b84300; }
.sum__rate { display: flex; align-items: center; gap: 10px; padding-left: 18px; border-left: 1.5px dashed #ffbf94; }
.sum__rate b { display: block; font-family: var(--num); font-size: 24px; font-weight: 800; color: #a63e00; line-height: 1.1; }
.sum__profit.is-neg { background: linear-gradient(120deg, #fff1f1, #ffdede); border-color: #f5bcbc; }
.sum__profit.is-neg .sum__pmain b { background: none; color: var(--neg); }
.sum__profit.is-neg .sum__pmain .sum__k, .sum__profit.is-neg .sum__rate b { color: var(--neg); }
.sum__profit.is-neg .sum__rate { border-left-color: #f2b0b0; }
.sum__rate.is-neg 
/* PC: 画面の高さに合わせ、合計バーを下段に固定。明細が多いときは売上・支出欄の中をスクロール */
@media (min-width: 1281px) and (min-height: 640px) {
  .main:has(.entries-page) { padding-bottom: 20px; }
  .entries-page { height: calc(100vh - 48px); display: flex; flex-direction: column; }
  .entries-page > .page-head { margin-bottom: 14px; }
  .entries-page .ctx { flex: none; margin-bottom: 14px; }
  .entries-page .ledgers { flex: 1 1 auto; min-height: 0; align-items: stretch; }
  .entries-page .ledger { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
  .entries-page .ledger .table-wrap { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .entries-page .ledger .table thead th { position: sticky; top: 0; z-index: 1; }
  .entries-page .ledger .card__head, .entries-page .ledger .ledger__foot { flex: none; }
  .entries-page .summary { position: static; flex: none; }
}
@media (max-width: 760px) {
  .summary { bottom: calc(70px + env(safe-area-inset-bottom)); flex-direction: column; gap: 10px; padding: 14px 12px 12px; }
  .sum__flow { gap: 8px; justify-content: space-between; flex-wrap: nowrap; padding: 0 4px; }
  .sum__item b { font-size: 17px; }
  .sum__profit { margin-left: 0; justify-content: space-between; padding: 10px 14px; }
  .sum__pmain { text-align: left; }
  .sum__pmain .sum__k { justify-content: flex-start; }
  .sum__pmain b { font-size: 30px; }
  .sum__rate { padding-left: 12px; }
    .sum__rate b { font-size: 19px; }
}

/* 案件登録: 工期を1行に */
.term-row { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.term-row__cell { display: grid; gap: 4px; width: 200px; }
.term-row__k { font-size: 11.5px; font-weight: 700; color: var(--muted); }
.term-row__sep { align-self: center; margin-top: 18px; color: var(--muted); font-weight: 700; }
.term-row__undecided { align-self: center; margin-top: 18px; margin-left: 6px; }
@media (max-width: 760px) {
  .term-row__cell { width: calc(50% - 18px); }
  .term-row__undecided { margin-top: 0; margin-left: 0; flex-basis: 100%; }
}

/* 日付入力（日本式 2026/11/01） */
.datef { position: relative; display: block; }
.datef__text { padding-right: 42px; font-family: var(--num); font-variant-numeric: tabular-nums; }
.datef__btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.datef__btn:hover:not(:disabled) { background: var(--signal-soft); color: var(--signal); }
.datef__btn:disabled { opacity: .35; cursor: not-allowed; }
.datef__btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.datef__native { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }
/* 収支入力ページでは通知を合計バーの上に表示 */
body:has(.entries-page) .toast-wrap { bottom: 140px; }
@media (max-width: 760px) { body:has(.entries-page) .toast-wrap { bottom: calc(240px + env(safe-area-inset-bottom)); } }

/* サイドバーの並べ替え */
.nav a.is-sortable { touch-action: none; -webkit-user-drag: none; user-select: none; }
.nav a.is-sortable::after {
  content: ""; margin-left: auto; width: 10px; height: 16px; flex: none; opacity: 0; transition: opacity .15s;
  background: radial-gradient(circle, #8a97ad 1.3px, transparent 1.6px) 0 0 / 5px 5px;
}
.nav a.is-sortable:hover::after { opacity: .8; }
.nav.is-sorting a { transition: none; }
.nav a.is-dragging { background: rgba(255, 106, 19, .18); color: #fff; box-shadow: 0 8px 20px rgba(0, 0, 0, .35); cursor: grabbing; outline: 1.5px dashed var(--signal); outline-offset: -2px; }
.js-nav-reset { background: none; border: 0; padding: 0; cursor: pointer; }
.sidebar__links .js-nav-reset[hidden] { display: none; }
.js-nav-reset[hidden] { display: none; }
@media (max-width: 760px) { .nav a.is-sortable::after { display: none; } }

/* マイページ: 前月比・前年比 */
.kpi__cmp { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 11.5px; color: var(--muted); }
.kpi--profit .kpi__cmp { border-top-color: #ffd2b0; }
.kpi__cmp span { white-space: nowrap; }
.kpi__cmp b { font-family: var(--num); font-weight: 700; margin-left: 3px; }
.kpi__cmp .is-good { color: var(--pos); }
.kpi__cmp .is-bad { color: var(--neg); }
.kpi__cmp .is-flat { color: var(--muted); }

/* ---------- 工事部 全体収支・個人収支（閲覧） ---------- */
.scope-pill { display: inline-flex; align-items: center; font-size: 12px; font-weight: 700; color: #2b4c9b; background: #e8eefb; border-radius: 999px; padding: 3px 10px; margin-left: 4px; letter-spacing: 0; }
.kpi__cmp .is-good { color: var(--pos); }
.kpi__cmp .is-bad { color: var(--neg); }
.kpi__cmp .is-flat { color: #9aa3b2; }
.dept-sec { margin-bottom: 20px; }
.dn-wrap { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; border-bottom: 1px solid var(--line); }
.dn { padding: 18px 22px; }
.dn + .dn { border-left: 1px solid var(--line); }
.dn__title { font-weight: 800; font-size: 14px; margin-bottom: 10px; }
.dn__body { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.dn__chart { position: relative; width: 168px; height: 168px; flex: none; }
.dn__chart svg { width: 100%; height: 100%; }
.dn__chart circle { transition: stroke-dasharray .6s ease; }
.dn__center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.dn__center span { font-size: 11px; color: var(--muted); font-weight: 700; }
.dn__center b { font-family: var(--num); font-size: 18px; font-weight: 800; line-height: 1.2; }
.dn__center b.is-neg { color: var(--neg); }
.dn__center small { font-size: 11px; color: var(--muted); }
.dn__legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; flex: 1 1 180px; min-width: 0; }
.dn__legend li { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.dn__legend i { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.dn__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dn__legend b { font-family: var(--num); font-weight: 700; }
.dn__note { margin: 10px 0 0; font-size: 12px; color: var(--neg); }
.who { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.who__dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.table tr.total td { background: #fff7f0; border-top: 2px solid #ffd2b0; font-weight: 700; }
.ro-note { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: #2b4c9b; background: #e8eefb; border-radius: 8px; padding: 6px 12px; }
.users-table code { font-family: var(--num); font-weight: 700; }
.pw-once { font-family: var(--num); font-size: 18px; font-weight: 800; letter-spacing: .04em; background: var(--signal-soft); border: 1.5px dashed var(--signal); border-radius: 8px; padding: 6px 12px; display: inline-block; }
@media (max-width: 1080px) { .dn-wrap { grid-template-columns: 1fr; } .dn + .dn { border-left: 0; border-top: 1px solid var(--line); } }
@media (max-width: 760px) { .dn__chart { width: 140px; height: 140px; } }
.sidebar__links > *, .sidebar__links form button { white-space: nowrap; }
@media (max-width: 760px) { .nav a span { line-height: 1.2; } }

/* マイページ⇔工事部全体の切り替え（青山さん・紀伊さんのみ） */
.h1row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.vswitch { display: inline-flex; padding: 3px; border-radius: 10px; background: #e9edf3; gap: 2px; }
.vswitch button { border: 0; background: transparent; padding: 7px 16px; border-radius: 8px; font-weight: 700; font-size: 13.5px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.vswitch button:hover { color: var(--text); }
.vswitch button.is-on { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(13, 23, 38, .15); }
.vswitch button.is-on::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--signal); margin-right: 7px; vertical-align: 1px; }

/* 収支明細の合計バー：売上・支出・利益を同じ大きさに（リングは廃止） */
.sum__item b, .sum__pmain b, .sum__rate b { font-size: 36px; line-height: 1.1; }
.sum__item b small, .sum__pmain b small, .sum__rate b small { font-size: 15px; }
.sum__rate { padding-left: 20px; }
@media (max-width: 760px) {
  .sum__item b, .sum__pmain b, .sum__rate b { font-size: 22px; }
  .sum__flow { flex-wrap: wrap; }
}

/* ---- 運送部：月締め・毎月のくり返し・社員共通経費 ---- */
.closebar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 14px; margin: 0 0 14px; border: 1px dashed var(--line); border-radius: 12px; background: #fff; font-size: 13px; }
.ledgers--single { grid-template-columns: minmax(0, 1fr); max-width: 860px; }
.tag-mini--rec { color: #2b4c9b; background: #e8eefb; margin-left: 6px; vertical-align: 1px; }
.rec-card { margin-top: 14px; }
.rec-card .table td { vertical-align: middle; }
.edit-grid .repeat { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding-top: 4px; border-top: 1px dashed var(--line); }
.edit-grid .repeat .hint { flex-basis: 100%; }
.repeat__opts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.repeat__opts[hidden] { display: none; }
.repeat__opts .select { width: auto; }
.repeat__k { font-size: 12px; color: var(--muted); }
.datef--month { max-width: 170px; }

.edit-grid .repeat { grid-column: 1 / -1; min-width: 0; }
.edit-grid .repeat .hint { white-space: normal; overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
@media (max-width: 760px) {
  .rec-card .card__head { flex-wrap: wrap; }
  .rec-card tbody, .rec-card table { display: block; }
  .rec-card tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .rec-card td { display: block; border: 0 !important; padding: 0 !important; text-align: left !important; }
  .rec-card td.tc-main { flex-basis: calc(100% - 70px); font-weight: 700; }
  .rec-card td:last-child { flex-basis: 100%; }
  .rec-card td:last-child .row { justify-content: flex-start !important; }
}

/* ---- 月別の推移グラフ（マイページ・部全体） ---- */
.trend { margin-bottom: 18px; }
.trend__head { flex-wrap: wrap; gap: 10px 16px; }
.trend__sub { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 10px; }
.trend__tools { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-left: auto; }
.trend__lgs { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text); }
.trend__lg { display: inline-flex; align-items: center; gap: 6px; }
.trend__lg i { width: 18px; height: 3px; border-radius: 2px; display: inline-block; }
.trend__lg.is-none { color: var(--muted); }
.trend__lg.is-none i { opacity: .35; }
.vswitch--sm button { padding: 5px 14px; font-size: 12.5px; }
.trend__plot { position: relative; padding: 4px 16px 10px; }
.trend__plot svg { display: block; overflow: visible; touch-action: pan-y; max-width: 100%; }
.trend__ax { font-size: 12px; fill: var(--muted); font-family: var(--num, inherit); }
.trend__ax.is-cur { fill: var(--text); font-weight: 700; }
.trend__name { font-size: 12px; font-weight: 700; fill: var(--text); }
.trend__tip { position: absolute; top: 14px; background: rgba(255, 255, 255, .68); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(23, 32, 51, .12); padding: 10px 12px; font-size: 11.5px; min-width: 250px; pointer-events: none; z-index: 2; }
.trend__tt { display: block; margin-bottom: 6px; font-size: 12px; }
.trend__row { display: flex; align-items: center; gap: 8px; margin: 4px 0; white-space: nowrap; }
.trend__row i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.trend__yl { min-width: 64px; }
.trend__row b { font-variant-numeric: tabular-nums; }
.trend__row b.neg { color: var(--neg); }
.trend__cmp { border-top: 1px solid var(--line); padding-top: 6px; margin-top: 6px; color: var(--muted); white-space: nowrap; }
@media (max-width: 760px) {
  .trend__sub { display: block; margin: 2px 0 0; }
  .trend__tools { margin-left: 0; }
  .trend__plot { padding: 4px 6px 8px; }
  .trend__tip { left: 8px !important; right: 8px !important; min-width: 0; }
}
.trend__plot svg.is-narrow .trend__ax { font-size: 10.5px; }
@media (max-width: 760px) {
  .trend__head .card__title { flex-basis: 100%; }
  .trend__tip { position: static; margin-top: 8px; box-shadow: none; background: var(--bg); }
  .trend__tools { gap: 10px; }
}
@media (max-width: 760px) { .trend__head .card__title { flex-wrap: wrap; } .trend__sub { flex-basis: 100%; } }
