/*
 * SFR Enterprise Data Grid 134
 * Canonical Excel-style grid for operational lists/reports with explicit opt-in direct-edit mode.
 * Data remains authoritative in backend/domain runtimes; this layer only changes reading, column width and export presentation.
 */
.sfr-a01[data-sfr-tool-id="business-accounting-management"]{
  --sfr-erp-grid-row-height:31px;
  --sfr-erp-grid-head-height:32px;
  --sfr-erp-grid-cell-pad-y:4px;
  --sfr-erp-grid-cell-pad-x:8px;
  --sfr-erp-grid-resizer:color-mix(in srgb,var(--sfr-erp-primary) 42%,transparent);
}
.sfr-a01[data-sfr-tool-id="business-accounting-management"] .sfr-erp-data-grid-toolbar{
  display:flex;
  align-items:center;
  gap:7px;
  min-height:34px;
  margin:0 0 6px;
  padding:0 1px;
  color:var(--sfr-erp-text-secondary);
  font-size:13px;
  line-height:1.3;
}
.sfr-a01[data-sfr-tool-id="business-accounting-management"] .sfr-erp-data-grid-readonly{
  display:inline-flex;
  align-items:center;
  min-height:24px;
  padding:2px 8px;
  border:1px solid var(--sfr-erp-border);
  border-radius:999px;
  background:var(--sfr-erp-surface-subtle);
  color:var(--sfr-erp-text-secondary)!important;
  font-size:13px!important;
  font-weight:600!important;
  white-space:nowrap;
}
.sfr-a01[data-sfr-tool-id="business-accounting-management"] .sfr-erp-data-grid-hint{
  flex:1 1 auto;
  min-width:120px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  color:var(--sfr-erp-text-muted)!important;
  font-size:13px!important;
  font-weight:450!important;
}
.sfr-a01[data-sfr-tool-id="business-accounting-management"] .sfr-erp-data-grid-status{
  min-width:0;
  color:var(--sfr-erp-text-muted)!important;
  font-size:13px!important;
  white-space:nowrap;
}
.sfr-a01[data-sfr-tool-id="business-accounting-management"] .sfr-erp-data-grid-toolbar .sfr-a02-btn{
  min-height:30px!important;
  height:30px;
  padding:3px 9px!important;
  border-radius:7px!important;
  font-size:13px!important;
  line-height:1.2!important;
  white-space:nowrap;
}
.sfr-a01[data-sfr-tool-id="business-accounting-management"] .sfr-erp-data-grid-scroll{
  display:block!important;
  width:100%!important;
  max-width:100%!important;
  overflow-x:auto!important;
  overflow-y:visible;
  border:1px solid var(--sfr-erp-border)!important;
  border-radius:8px!important;
  background:var(--sfr-erp-surface)!important;
  box-shadow:none!important;
  scrollbar-width:thin;
  scrollbar-color:var(--sfr-erp-border-strong) transparent;
  overscroll-behavior-inline:contain;
}
.sfr-a01[data-sfr-tool-id="business-accounting-management"] .sfr-erp-data-grid-scroll::-webkit-scrollbar{height:9px}
.sfr-a01[data-sfr-tool-id="business-accounting-management"] .sfr-erp-data-grid-scroll::-webkit-scrollbar-thumb{background:var(--sfr-erp-border-strong);border:2px solid transparent;border-radius:999px;background-clip:padding-box}
.sfr-a01[data-sfr-tool-id="business-accounting-management"] table.sfr-erp-data-grid-table{
  max-width:none!important;
  margin:0!important;
  border:0!important;
  border-collapse:separate!important;
  border-spacing:0!important;
  table-layout:fixed!important;
  background:var(--sfr-erp-surface)!important;
  color:var(--sfr-erp-text-main)!important;
  font-variant-numeric:tabular-nums;
}
.sfr-a01[data-sfr-tool-id="business-accounting-management"] table.sfr-erp-data-grid-table thead th{
  position:sticky!important;
  top:0;
  z-index:3;
  box-sizing:border-box!important;
  height:var(--sfr-erp-grid-head-height)!important;
  min-height:var(--sfr-erp-grid-head-height)!important;
  max-height:var(--sfr-erp-grid-head-height)!important;
  padding:var(--sfr-erp-grid-cell-pad-y) var(--sfr-erp-grid-cell-pad-x)!important;
  border-top:0!important;
  border-inline-start:0!important;
  border-inline-end:1px solid var(--sfr-erp-divider)!important;
  border-bottom:1px solid var(--sfr-erp-border-strong)!important;
  background:var(--sfr-erp-surface-muted)!important;
  color:var(--sfr-erp-text-secondary)!important;
  font-size:13px!important;
  font-weight:650!important;
  line-height:1.2!important;
  text-align:start!important;
  white-space:nowrap!important;
  overflow:visible!important;
  text-overflow:clip!important;
  user-select:none;
}
.sfr-a01[data-sfr-tool-id="business-accounting-management"] table.sfr-erp-data-grid-table tbody td{
  box-sizing:border-box!important;
  height:var(--sfr-erp-grid-row-height)!important;
  min-height:var(--sfr-erp-grid-row-height)!important;
  max-height:var(--sfr-erp-grid-row-height)!important;
  padding:var(--sfr-erp-grid-cell-pad-y) var(--sfr-erp-grid-cell-pad-x)!important;
  border-top:0!important;
  border-inline-start:0!important;
  border-inline-end:1px solid var(--sfr-erp-divider)!important;
  border-bottom:1px solid var(--sfr-erp-divider)!important;
  background:var(--sfr-erp-surface)!important;
  color:var(--sfr-erp-text-main)!important;
  font-size:13.5px!important;
  font-weight:400!important;
  line-height:1.2!important;
  vertical-align:middle!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
}
.sfr-a01[data-sfr-tool-id="business-accounting-management"] table.sfr-erp-data-grid-table tr:last-child td{border-bottom:0!important}
.sfr-a01[data-sfr-tool-id="business-accounting-management"] table.sfr-erp-data-grid-table :is(th,td):last-child{border-inline-end:0!important}
.sfr-a01[data-sfr-tool-id="business-accounting-management"] table.sfr-erp-data-grid-table tbody tr:hover>td{background:color-mix(in srgb,var(--sfr-erp-primary) 3.5%,var(--sfr-erp-surface))!important}
.sfr-a01[data-sfr-tool-id="business-accounting-management"] table.sfr-erp-data-grid-table td :where(strong,b,small,span,bdi,a,button){line-height:1.15!important}
.sfr-a01[data-sfr-tool-id="business-accounting-management"] table.sfr-erp-data-grid-table td>small{
  display:inline!important;
  margin:0!important;
  padding:0!important;
  color:var(--sfr-erp-text-muted)!important;
  font-size:13px!important;
  white-space:nowrap!important;
}
.sfr-a01[data-sfr-tool-id="business-accounting-management"] table.sfr-erp-data-grid-table td>small:not(:first-child)::before{content:" · ";color:var(--sfr-erp-text-muted)}
.sfr-a01[data-sfr-tool-id="business-accounting-management"] table.sfr-erp-data-grid-table td .sfr-a02-btn,
.sfr-a01[data-sfr-tool-id="business-accounting-management"] table.sfr-erp-data-grid-table td button{
  min-height:25px!important;
  height:25px!important;
  padding:2px 7px!important;
  border-radius:6px!important;
  font-size:13px!important;
  line-height:1!important;
  vertical-align:middle;
}
.sfr-a01[data-sfr-tool-id="business-accounting-management"] .sfr-erp-grid-resizer{
  position:absolute;
  inset-block:0;
  inset-inline-end:-5px;
  z-index:5;
  width:10px;
  cursor:col-resize;
  touch-action:none;
  outline:0;
}
.sfr-a01[data-sfr-tool-id="business-accounting-management"] .sfr-erp-grid-resizer::after{
  content:"";
  position:absolute;
  inset-block:5px;
  inset-inline-start:4px;
  width:1px;
  border-radius:1px;
  background:transparent;
  transition:background 120ms ease,width 120ms ease;
}
.sfr-a01[data-sfr-tool-id="business-accounting-management"] :is(th:hover .sfr-erp-grid-resizer,.sfr-erp-grid-resizer:focus-visible)::after,
.sfr-a01[data-sfr-tool-id="business-accounting-management"] table.sfr-erp-data-grid-table.is-resizing .sfr-erp-grid-resizer::after{width:2px;background:var(--sfr-erp-grid-resizer)}
html.sfr-erp-grid-resizing,html.sfr-erp-grid-resizing *{cursor:col-resize!important;user-select:none!important}

/* The page itself never owns horizontal overflow; only the grid scroll container may scroll horizontally. */
.sfr-a01[data-sfr-tool-id="business-accounting-management"] [data-sfr-smart-erp-main="true"]{min-width:0!important;max-width:100%!important;overflow-x:hidden!important}

@media(max-width:760px){
  .sfr-a01[data-sfr-tool-id="business-accounting-management"] .sfr-erp-data-grid-toolbar{flex-wrap:wrap;gap:5px}
  .sfr-a01[data-sfr-tool-id="business-accounting-management"] .sfr-erp-data-grid-hint{order:5;flex-basis:100%;min-width:0}
  .sfr-a01[data-sfr-tool-id="business-accounting-management"] .sfr-erp-data-grid-status{display:none}
  .sfr-a01[data-sfr-tool-id="business-accounting-management"] table.sfr-erp-data-grid-table thead{display:table-header-group!important}
  .sfr-a01[data-sfr-tool-id="business-accounting-management"] table.sfr-erp-data-grid-table tbody{display:table-row-group!important}
  .sfr-a01[data-sfr-tool-id="business-accounting-management"] table.sfr-erp-data-grid-table tr{display:table-row!important}
  .sfr-a01[data-sfr-tool-id="business-accounting-management"] table.sfr-erp-data-grid-table :is(th,td){display:table-cell!important}
  .sfr-a01[data-sfr-tool-id="business-accounting-management"] table.sfr-erp-data-grid-table td::before{display:none!important;content:none!important}
}

@media print{
  .sfr-a01[data-sfr-tool-id="business-accounting-management"] .sfr-erp-data-grid-toolbar,
  .sfr-a01[data-sfr-tool-id="business-accounting-management"] .sfr-erp-grid-resizer{display:none!important}
  .sfr-a01[data-sfr-tool-id="business-accounting-management"] .sfr-erp-data-grid-scroll{overflow:visible!important;border:0!important}
  .sfr-a01[data-sfr-tool-id="business-accounting-management"] table.sfr-erp-data-grid-table{width:100%!important;table-layout:auto!important}
}

/* Patch 210 / Data Grid 134R1 — canonical opt-in editable spreadsheet mode.
 * Existing editor grids remain excluded unless they explicitly opt in with data-sfr-grid-editable="true". */
.sfr-a01[data-sfr-tool-id="business-accounting-management"] .sfr-erp-data-grid-readonly.is-editable{
  border-color:color-mix(in srgb,var(--sfr-erp-primary) 28%,var(--sfr-erp-border));
  background:color-mix(in srgb,var(--sfr-erp-primary) 7%,var(--sfr-erp-surface));
  color:var(--sfr-erp-primary)!important;
}
.sfr-a01[data-sfr-tool-id="business-accounting-management"] table.sfr-erp-data-grid-table.is-editable tbody td{height:36px!important;min-height:36px!important;max-height:36px!important;padding-block:3px!important}
.sfr-a01[data-sfr-tool-id="business-accounting-management"] table.sfr-erp-data-grid-table.is-editable td :is(input,select,textarea,[contenteditable="true"]){box-sizing:border-box;width:100%;min-width:0;min-height:27px;margin:0;padding:3px 6px;border:1px solid transparent;border-radius:5px;background:transparent;color:var(--sfr-erp-text-main);font:600 13.5px/1.2 Inter,Cairo,sans-serif;outline:0}
.sfr-a01[data-sfr-tool-id="business-accounting-management"] table.sfr-erp-data-grid-table.is-editable td :is(input,select,textarea,[contenteditable="true"]):hover{border-color:var(--sfr-erp-border)}
.sfr-a01[data-sfr-tool-id="business-accounting-management"] table.sfr-erp-data-grid-table.is-editable td :is(input,select,textarea,[contenteditable="true"]):focus{border-color:var(--sfr-erp-primary);background:var(--sfr-erp-surface);box-shadow:0 0 0 2px color-mix(in srgb,var(--sfr-erp-primary) 12%,transparent)}
.sfr-a01[data-sfr-tool-id="business-accounting-management"] table.sfr-erp-data-grid-table.is-editable td:focus-within{background:color-mix(in srgb,var(--sfr-erp-primary) 4%,var(--sfr-erp-surface))!important}


/* Patch 214 — compact reset-columns action using SFR Central Icon System. */
.sfr-a01[data-sfr-tool-id="business-accounting-management"] .sfr-erp-data-grid-toolbar .sfr-erp-data-grid-reset{display:inline-grid!important;place-items:center!important;flex:0 0 28px!important;width:28px!important;min-width:28px!important;max-width:28px!important;height:28px!important;min-height:28px!important;padding:4px!important;border-radius:7px!important;font-size:0!important;line-height:0!important}
.sfr-a01[data-sfr-tool-id="business-accounting-management"] .sfr-erp-data-grid-reset .sfr-icon{display:block;width:17px;height:17px;pointer-events:none}
.sfr-a01[data-sfr-tool-id="business-accounting-management"] .sfr-erp-data-grid-reset>span{font-size:16px;line-height:1}


/* Patch 303 — central icon-only Excel action. Text remains available through title/aria-label. */
.sfr-a01[data-sfr-tool-id="business-accounting-management"] .sfr-erp-excel-icon-action{
  display:inline-grid!important;
  place-items:center!important;
  flex:0 0 30px!important;
  width:30px!important;
  min-width:30px!important;
  max-width:30px!important;
  height:30px!important;
  min-height:30px!important;
  margin-inline-start:auto!important;
  padding:3px!important;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
  box-shadow:none!important;
  color:var(--sfr-erp-primary)!important;
  font-size:0!important;
  line-height:0!important;
}
.sfr-a01[data-sfr-tool-id="business-accounting-management"] .sfr-erp-excel-icon-action .sfr-icon,
.sfr-a01[data-sfr-tool-id="business-accounting-management"] .sfr-erp-excel-icon-action .sfr-erp-excel-action__icon{
  display:block!important;
  width:18px!important;
  height:18px!important;
  pointer-events:none!important;
}
.sfr-a01[data-sfr-tool-id="business-accounting-management"] .sfr-erp-excel-icon-action>span{font-size:17px!important;line-height:1!important}

/* Patch 304 — export action is a clean arrow at the opposite toolbar edge. */
.sfr-a01[data-sfr-tool-id="business-accounting-management"] .sfr-erp-excel-icon-action:hover{background:transparent!important;border-color:transparent!important;box-shadow:none!important;opacity:.78}
.sfr-a01[data-sfr-tool-id="business-accounting-management"] .sfr-erp-excel-icon-action:focus-visible{background:transparent!important;box-shadow:none!important;outline:2px solid color-mix(in srgb,var(--sfr-erp-primary) 42%,transparent)!important;outline-offset:2px!important}

/* 306R2 — Canonical stable-cell surface for editable Excel-style grids.
 * Consumers opt in with data-sfr-grid-stable-cells="true"; Shared Data Grid remains the visual owner. */
.sfr-a01[data-sfr-tool-id="business-accounting-management"] table.sfr-erp-data-grid-table.is-editable[data-sfr-grid-stable-cells="true"] tbody td,
.sfr-a01[data-sfr-tool-id="business-accounting-management"] table.sfr-erp-data-grid-table.is-editable[data-sfr-grid-stable-cells="true"] tbody tr:hover>td,
.sfr-a01[data-sfr-tool-id="business-accounting-management"] table.sfr-erp-data-grid-table.is-editable[data-sfr-grid-stable-cells="true"] tbody td:focus-within{
  background:var(--sfr-erp-surface)!important;
  transition:none!important;
}
.sfr-a01[data-sfr-tool-id="business-accounting-management"] table.sfr-erp-data-grid-table.is-editable[data-sfr-grid-stable-cells="true"] td :is(input,select,textarea,[contenteditable="true"]),
.sfr-a01[data-sfr-tool-id="business-accounting-management"] table.sfr-erp-data-grid-table.is-editable[data-sfr-grid-stable-cells="true"] td :is(input,select,textarea,[contenteditable="true"]):hover,
.sfr-a01[data-sfr-tool-id="business-accounting-management"] table.sfr-erp-data-grid-table.is-editable[data-sfr-grid-stable-cells="true"] td :is(input,select,textarea,[contenteditable="true"]):focus{
  background:transparent!important;
  transition:none!important;
}
.sfr-a01[data-sfr-tool-id="business-accounting-management"] table.sfr-erp-data-grid-table.is-editable[data-sfr-grid-stable-cells="true"] tbody td.sfr-sales-grid-rowno,
.sfr-a01[data-sfr-tool-id="business-accounting-management"] table.sfr-erp-data-grid-table.is-editable[data-sfr-grid-stable-cells="true"] tbody td.sfr-sales-grid-actions{
  background:var(--sfr-erp-surface-muted)!important;
}


/* 306R4 — Shared editable-grid required-field state.
 * Used by sales invoice row validation and available to other canonical editable grids via aria-invalid. */
.sfr-a01[data-sfr-tool-id="business-accounting-management"] table.sfr-erp-data-grid-table.is-editable td :is(input,select,textarea,[contenteditable="true"])[aria-invalid="true"]{
  border-color:var(--sfr-danger,#b42318)!important;
  background:color-mix(in srgb,var(--sfr-danger,#b42318) 7%,var(--sfr-erp-surface))!important;
  box-shadow:0 0 0 2px color-mix(in srgb,var(--sfr-danger,#b42318) 12%,transparent)!important;
}
