/* ===== 現場管理台帳（/site-ledger） ===== */

.sl-page { max-width: 100%; }

/* ---- 基本情報 ---- */
.sl-head { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; align-items: start; }
@media (max-width: 1100px) { .sl-head { grid-template-columns: 1fr; } }
.sl-kpi { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: center;
          background: #f6faf7; border: 1px solid #d9e8dd; border-radius: 8px; padding: 10px 14px; }
.sl-kpi .k { color: #557; font-size: 12px; white-space: nowrap; }
.sl-kpi .v { text-align: right; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sl-kpi .v.neg { color: #c62828; }
.sl-kpi .v.small { font-size: 14px; font-weight: 500; }

/* ---- 表（月別集計・明細） ---- */
.sl-scroll { overflow-x: auto; overflow-y: visible; border: 1px solid #cfd8dc; border-radius: 6px; background: #fff; }
.sl-grid { border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 13px; min-width: 100%; }
.sl-grid th, .sl-grid td { border-right: 1px solid #e0e0e0; border-bottom: 1px solid #e0e0e0; padding: 0; height: 30px; white-space: nowrap; }
.sl-grid thead th { background: #eef4f0; font-weight: 600; text-align: center; padding: 4px 6px; position: sticky; top: 0; z-index: 2; }
.sl-grid thead th.month { background: #dfeaf5; }
.sl-grid thead th.total { background: #fdf2d0; }
.sl-grid thead tr.sub th { font-weight: 400; font-size: 11px; color: #555; background: #f5f7f6; }
.sl-grid td.label { padding: 4px 8px; background: #f8f9f8; font-weight: 500; }
.sl-grid td.label.indent { padding-left: 22px; font-weight: 400; }
.sl-grid td.num { text-align: right; padding: 4px 8px; font-variant-numeric: tabular-nums; }
.sl-grid td.total { background: #fff8e1; font-weight: 600; }
.sl-grid tr.emph td { font-weight: 600; background: #f1f8f2; }
.sl-grid tr.gross td { background: #fafafa; }
.sl-grid td.neg { color: #c62828; }
.sl-grid td.calc { color: #333; }
.sl-grid tr.uncat td { color: #9a6a00; font-style: italic; }

/* 左端列を固定 */
.sl-grid .sticky-1 { position: sticky; left: 0; z-index: 1; background: #fff; }
.sl-grid thead .sticky-1 { z-index: 3; background: #eef4f0; }
.sl-grid .sticky-1.label { background: #f8f9f8; }
.sl-grid .sticky-1::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 1px; background: #cfd8dc; }

/* 入力セル */
.sl-grid input, .sl-grid select {
    width: 100%; height: 30px; border: 0; padding: 2px 6px; box-sizing: border-box;
    font: inherit; font-size: 13px; background: transparent; outline: none;
}
.sl-grid input.sl-num { text-align: right; font-variant-numeric: tabular-nums; }
.sl-grid input:focus, .sl-grid select:focus { background: #fff9c4; box-shadow: inset 0 0 0 2px #23aa64; }
.sl-grid td.edit { background: #fffef7; }
.sl-grid td.edit.sales { background: #fff3e0; }
.sl-grid input::placeholder { color: #c0c0c0; }
.sl-grid select { appearance: auto; cursor: pointer; }

/* 明細の列幅 */
.sl-detail col.c-menu { width: 34px; }
.sl-detail col.c-cat { width: 112px; }
.sl-detail col.c-payee { width: 190px; }
.sl-detail col.c-qty { width: 64px; }
.sl-detail col.c-unit { width: 56px; }
.sl-detail col.c-amt { width: 104px; }
.sl-detail col.c-tqty { width: 70px; }
.sl-detail col.c-tamt { width: 112px; }
.sl-detail .payee-wrap { display: flex; align-items: center; }
.sl-detail .payee-wrap input { flex: 1; }
.sl-detail .warn { color: #e65100; font-size: 11px; padding: 0 4px; }
.sl-detail td.rowmenu { text-align: center; }
.sl-detail td.rowmenu button { border: 0; background: transparent; cursor: pointer; color: #888; padding: 4px; }
.sl-detail td.rowmenu button:hover { color: #333; }
.sl-detail tr.blank td { opacity: .85; }

/* 月別集計の列幅 */
.sl-summary col.c-label { width: 150px; }
.sl-summary col.c-month { width: 112px; }
.sl-summary col.c-total { width: 124px; }

/* 想定（契約金額・想定原価）の列 */
.sl-grid thead th.planned { background: #ede7f6; color: #4a2c7a; }
.sl-grid td.planned { background: #f7f3fb; }
.sl-grid thead th.planned:first-of-type, .sl-grid td.planned:first-of-type { border-left: 2px solid #b39ddb; }

/* ---- 集計の条件 ---- */
.sl-sum-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.sl-sum-row .mud-input-control { margin: 0; }
.sl-sum-row > .mud-select { flex: 0 0 auto; width: 220px; }
.sl-sum-field { display: inline-flex; align-items: center; gap: 6px; }
.sl-sum-field .mud-select { width: 90px; flex: 0 0 auto; }
.sl-sum-range { display: inline-flex; align-items: center; gap: 6px; }
.sl-sum-range .mud-picker { width: 150px; flex: 0 0 auto; }
.sl-sum-range .mud-input-control { margin: 0; }
.sl-sum-range input { text-align: center; }
.sl-sum-tilde { color: #666; }

/* ---- 一覧 ---- */
.sl-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.sl-card { border: 1px solid #d9e0dc; border-radius: 10px; padding: 10px 14px; background: #fff; cursor: pointer; transition: box-shadow .15s; }
.sl-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,.12); border-color: #23aa64; }
.sl-card .t { font-size: 16px; font-weight: 600; margin: 2px 0; }
.sl-card .s { color: #666; font-size: 12px; }
.sl-card .m { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px; margin-top: 6px; font-size: 12px; }
.sl-card .m b { display: block; font-size: 14px; font-variant-numeric: tabular-nums; }

/* 保存状態 */
.sl-save { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 2px 10px; border-radius: 12px; }
.sl-save.saved { background: #e8f5e9; color: #2e7d32; }
.sl-save.dirty { background: #fff3e0; color: #e65100; }
.sl-save.saving { background: #e3f2fd; color: #1565c0; }
.sl-save.error { background: #ffebee; color: #c62828; }

.sl-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.sl-section { display: flex; align-items: center; gap: 8px; margin: 14px 0 6px; }
.sl-section h6 { margin: 0; }
.sl-hint { color: #777; font-size: 12px; }
