/* bill-receipt-layout-studio 2.0.6 · ToolCMS Spec 3.17 */
:root{--brl-field-label-offset:22px}
.bill-receipt-layout-studio-app{width:100%;max-width:100%;min-width:0;margin:0;box-sizing:border-box;font-family:inherit;color:var(--text,#1e293b);font-size:14px}
.bill-receipt-layout-studio-app *{box-sizing:border-box}
.brl-grid{display:grid;grid-template-columns:minmax(0,3fr) minmax(0,2fr);gap:16px;align-items:start;width:100%}
.brl-col{min-width:0;display:flex;flex-direction:column;gap:14px}
.brl-card{align-self:stretch;width:100%;min-width:0;background:var(--card,#fff);border:1px solid var(--border,#e5e7eb);border-radius:10px;padding:14px 16px;box-shadow:0 1px 2px rgba(15,23,42,.04)}
.brl-card h2{font-size:15px;margin:0 0 12px;padding-left:9px;border-left:4px solid var(--primary,#2563eb);color:var(--text,#1e293b);font-weight:700}
.brl-group-title{font-size:13px;font-weight:700;margin:12px 0 8px;padding-left:8px;border-left:3px solid var(--primary,#2563eb);color:var(--text,#1e293b)}
.brl-row{display:flex;flex-wrap:wrap;gap:10px;align-items:flex-start;margin-bottom:9px}
.brl-col-cell{display:flex;flex-direction:column;min-width:0;flex:1 1 180px}
.brl-col-auto{margin-top:var(--brl-field-label-offset,22px);flex:0 0 auto}
.brl-label{display:block;font-size:12px;line-height:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--muted,#64748b);margin-bottom:6px}
.brl-hint{font-size:11px;line-height:14px;color:var(--muted,#94a3b8);margin-top:4px}
.brl-input,.brl-select,.brl-textarea{width:100%;height:34px;padding:0 9px;border:1px solid var(--border,#cbd5e1);border-radius:6px;background:var(--input-bg,#fff);color:var(--text,#1e293b);font-size:13px;outline:none}
.brl-textarea{height:60px;padding:7px 9px;resize:vertical;line-height:1.5}
.brl-input:focus,.brl-select:focus,.brl-textarea:focus{border-color:var(--primary,#2563eb);box-shadow:0 0 0 3px var(--primary-light,#e0e7ff)}
.brl-range-wrap{display:flex;align-items:center;gap:9px;height:34px}
input[type=range].bill-receipt-layout-studio-range{-webkit-appearance:none;appearance:none;width:100%;height:16px;max-height:34px;background:transparent;border:0;margin:0;padding:0;flex:1 1 auto}
input[type=range].bill-receipt-layout-studio-range::-webkit-slider-runnable-track{height:5px;border-radius:3px;background:linear-gradient(to right,var(--primary,#10B981) 0 var(--fill,50%),#E5E7EB var(--fill,50%) 100%)}
input[type=range].bill-receipt-layout-studio-range::-webkit-slider-thumb{-webkit-appearance:none;width:14px;height:14px;border-radius:50%;background:var(--primary,#10B981);margin-top:-4.5px;border:0}
input[type=range].bill-receipt-layout-studio-range::-moz-range-progress{background:var(--primary,#10B981);height:5px}
.brl-range-val{min-width:46px;text-align:right;font-size:12px;font-variant-numeric:tabular-nums;color:var(--text,#1e293b);white-space:nowrap}
.brl-checks{display:flex;flex-wrap:wrap;gap:8px 16px}
.brl-chk{display:inline-flex;align-items:center;gap:6px;white-space:nowrap;font-size:12px;color:var(--text,#1e293b)}
.brl-chk input{accent-color:var(--primary,#2563eb);width:15px;height:15px}
.brl-actions{display:flex;flex-wrap:wrap;gap:9px;align-items:center}
.brl-btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:34px;padding:0 13px;border-radius:7px;border:1px solid var(--border,#cbd5e1);background:var(--card,#fff);color:var(--text,#1e293b);font-size:13px;cursor:pointer;white-space:nowrap}
.brl-btn:hover{border-color:var(--primary,#2563eb)}
.brl-btn svg{width:16px;height:16px;flex:0 0 16px;fill:currentColor}
.brl-btn-primary{background:var(--primary,#2563eb);color:var(--text-on-accent,#fff);border-color:var(--primary,#2563eb)}
.brl-btn-primary:hover{filter:brightness(1.06)}
.brl-tplwall{display:grid;grid-template-columns:repeat(auto-fill,minmax(152px,1fr));gap:8px}
.brl-chip{border:1px solid var(--border,#e2e8f0);border-radius:7px;background:var(--card,#fff);padding:8px 9px;text-align:left;font-size:12px;color:var(--text,#1e293b);cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.brl-chip:hover{border-color:var(--primary,#2563eb)}
.brl-chip[aria-pressed=true]{border-color:var(--primary,#2563eb);background:var(--primary-light,#eff6ff);color:var(--primary,#2563eb);font-weight:700}
.brl-cats{display:flex;flex-wrap:wrap;gap:7px;margin-bottom:10px}
.brl-cat{padding:5px 10px;border-radius:999px;border:1px solid var(--border,#e2e8f0);background:var(--card,#fff);font-size:12px;cursor:pointer;white-space:nowrap;color:var(--text,#1e293b)}
.brl-cat[aria-pressed=true]{background:var(--primary,#2563eb);color:var(--text-on-accent,#fff);border-color:var(--primary,#2563eb)}
.brl-stat{font-size:12px;color:var(--muted,#64748b);margin-bottom:9px;white-space:nowrap}
.brl-filepick{display:flex;align-items:center;gap:9px;flex-wrap:wrap}
.bill-receipt-layout-studio-filepick label[for]{display:inline-flex;align-items:center;gap:6px;min-height:34px;padding:0 13px;border-radius:7px;background:var(--primary,#2563eb);color:var(--text-on-accent,#fff);font-size:13px;cursor:pointer;white-space:nowrap}
.bill-receipt-layout-studio-filepick label[for] svg{width:16px;height:16px;fill:currentColor}
.bill-receipt-layout-studio-filepick input[type=file]{position:absolute;width:1px;height:1px;opacity:0;overflow:hidden}
.bill-receipt-layout-studio-filepick label[for]:focus-visible{outline:3px solid var(--primary,#2563eb);outline-offset:2px}
.bill-receipt-layout-studio-filepick:focus-within{box-shadow:0 0 0 3px var(--primary-light,#dbeafe);border-radius:8px}
.bill-receipt-layout-studio-filepick.brl-drag{background:var(--primary-light,#eff6ff)}
.brl-filename{font-size:12px;color:var(--muted,#64748b);max-width:230px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.brl-preview{position:relative;width:100%;min-width:0}
.brl-canvas-shell{width:100%;overflow:auto;border:1px solid var(--border,#e2e8f0);border-radius:8px;background:#f8fafc}
#brl-canvas{display:block;width:100%;height:auto;background:#fff}
.brl-boot #brl-canvas{visibility:hidden}
.brl-msg{font-size:12px;color:var(--primary,#2563eb);min-height:18px;margin-top:8px}
#brl-preview-actions{margin-top:10px}
.brl-note{font-size:11px;line-height:1.65;color:var(--muted,#64748b);border-top:1px solid var(--border,#e5e7eb);padding-top:10px;margin-top:10px}
.brl-note b{color:var(--text,#1e293b)}
.brl-col-side{align-self:start;position:sticky;top:12px;max-height:calc(100vh - 24px);overflow:auto;min-width:0}
/* sticky 要有行程：外层列必须撑满整行高度（行高由左栏决定），卡片本身不拉伸。
   2.0.2 两张症状：卡片 align-self:stretch 被拉成整行、内容滚走只剩空壳；外层 .brl-col
   高度等于卡片，sticky 的包含块没有余量，等于完全不吸。 */
.brl-sticky-card{position:static;width:100%;min-width:0}
/* 只压预览画布区的高度，卡片本身仍是自然高度：
   画布区占「视口高度 − 卡片外框与操作区」，保证吸附时按钮与合规声明同屏可见；
   画布区本来就有 overflow:auto，超长样张在区内滚动，不外溢、不遮住宿主内容。 */
.brl-sticky-card .brl-canvas-shell{max-height:calc(100vh - 300px)}
.brl-fullscreen{position:fixed!important;inset:0!important;max-height:none!important;z-index:99998;background:var(--card,#fff);padding:18px!important;overflow:auto;border-radius:0!important}
.brl-fullscreen #brl-canvas{max-height:none}
.brl-fullscreen .brl-canvas-shell{max-height:none}
.brl-print-only{display:none}
.brl-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
@media(max-width:960px){.brl-grid{grid-template-columns:1fr}.brl-col-side{position:static;max-height:none;overflow:visible}}
@media(max-width:640px){.brl-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.brl-actions>:only-child{grid-column:1/-1}.brl-tplwall{grid-template-columns:repeat(2,minmax(0,1fr))}.brl-col-cell{flex-basis:100%}}
@media print{
  .bill-receipt-layout-studio-app>*:not(.brl-print-only){display:none!important}
  .brl-print-only{display:block!important;position:static!important;width:100%!important;margin:0!important;padding:0!important;border:0!important;box-shadow:none!important}
  .brl-print-only img{display:block;width:100%;max-width:100%;height:auto}
  .brl-note,.brl-actions,.brl-msg,.brl-cats,.brl-tplwall,.brl-card{display:none!important}
  @page{margin:0}
}

/* ---- v2 新增组件：明细行 / 核算 / 批量 / 收藏 / 校验 ---- */
.brl-rows{display:flex;flex-direction:column;gap:6px;margin:0 0 10px}
.brl-rowitem{display:grid;grid-template-columns:minmax(0,3fr) minmax(0,1fr) minmax(0,1fr) minmax(0,1.2fr) 64px;gap:6px;align-items:center;min-width:0}
.brl-rowhead{font-size:12px;font-weight:700;color:var(--text,#1e293b)}
.brl-rowcell{font-size:12px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.brl-rowin{width:100%;min-width:0;padding:5px 7px;font-size:13px}
.brl-ramt{font-variant-numeric:tabular-nums;color:var(--primary,#2563eb);font-weight:700}
.brl-mini{padding:5px 8px;border:1px solid var(--border,#e5e7eb);border-radius:6px;background:var(--card,#fff);color:var(--text,#1e293b);font-size:12px;cursor:pointer;white-space:nowrap}
.brl-mini:hover{border-color:var(--primary,#2563eb)}
.brl-mini-primary{background:var(--primary,#2563eb);border-color:var(--primary,#2563eb);color:#fff;font-weight:700}
.brl-totals{margin:8px 0 4px;padding:8px 10px;border-radius:6px;background:var(--primary-light,#f0f5ff);color:var(--text,#1e293b);font-size:13px;font-variant-numeric:tabular-nums;font-weight:700}
.brl-valid{margin-top:6px;padding:6px 10px;border-left:4px solid var(--primary,#2563eb);background:var(--card,#fff);font-size:12px;color:var(--text,#1e293b)}
.brl-valid-bad{border-left-color:#dc2626;color:#b91c1c}
.brl-favs{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
.brl-hint{font-size:12px;color:var(--text,#64748b)}
@media (max-width:640px){
  .brl-rowitem{grid-template-columns:minmax(0,2fr) minmax(0,1fr) minmax(0,1fr) 64px}
  .brl-rowitem .brl-rowin:nth-child(3){grid-column:1 / span 2}
  .brl-rowitem .brl-ramt{grid-column:3}
  .brl-actions{grid-template-columns:repeat(2,minmax(0,1fr))}
}

/* 滚动时间线吸附：合成层随滚动线性位移，不依赖 scroll 事件频率 */
@keyframes brl-follow-kf{from{transform:translate3d(0,0,0)}to{transform:translate3d(0,var(--brl-travel,0px),0)}}
.brl-col-side.brl-follow-native{position:relative;top:0;animation:brl-follow-kf linear both;animation-timeline:scroll(root block);animation-range:var(--brl-start,0px) var(--brl-end,0px)}
@media(max-width:960px){.brl-col-side.brl-follow-native{animation:none;position:static}}
