/* Full-size form controls share a scale across the daily store workflows. */
body.sy-admin {
  --sy-operation-height: var(--sy-control-height);
  --sy-operation-font: var(--sy-body-size);
}

@media (max-width: 700px) {
  body.sy-admin {
    --sy-operation-height: max(36px, var(--sy-control-height));
  }
}

/* Search wrappers include their own borders and clear controls. */
html .sy-admin #storeBody :is(
  .issue-studio, .sy-redeem-form, .commerce-section:has(.sy-appointment-tools), .sy-fin-workspace
) .sy-query-control {
  --query-height: var(--sy-operation-height);
  font-size: var(--sy-operation-font);
  border-radius: var(--sy-control-radius) !important;
}

.sy-admin #storeBody .sy-finance :is(.sy-fin-table > header[data-fin-toolbar], .sy-pay-toolbar[data-fin-toolbar]) {
  --sy-fin-query-height: var(--sy-operation-height);
}

html .sy-admin .ff-search {
  --ff-control-height: var(--sy-operation-height);
}

/* Apply the form sizing to triggers as well as visible native fallbacks. */
.sy-admin #storeBody :is(
  #issueStudio, .sy-redeem-form, .commerce-section:has(.sy-appointment-tools), .sy-fin-workspace
) :is(
  input:not([type=checkbox], [type=radio], [type=file], [type=hidden], .sy-coupon-date-input),
  select:not(.sy-select-native),
  .sy-select-trigger,
  button.sy-coupon-date-trigger,
  button.sy-range-trigger
):not(:is(.sy-query-control, .flatpickr-calendar, .sy-range-panel) *),
.sy-admin :is(.sy-fin-dialog, .ff-dialog, .fr-dialog) :is(
  input:not([type=checkbox], [type=radio], [type=file], [type=hidden], .sy-coupon-date-input),
  select:not(.sy-select-native),
  .sy-select-trigger,
  button.sy-coupon-date-trigger,
  button.sy-range-trigger
):not(:is(.sy-query-control, .flatpickr-calendar, .sy-range-panel) *) {
  box-sizing: border-box;
  height: var(--sy-operation-height) !important;
  min-height: var(--sy-operation-height) !important;
  border-radius: var(--sy-control-radius);
  font-size: var(--sy-operation-font) !important;
}

.sy-admin #storeBody :is(
  #issueStudio, .sy-redeem-form, .commerce-section:has(.sy-appointment-tools), .sy-fin-workspace
) :is(textarea, .sy-query-control input),
.sy-admin :is(.sy-fin-dialog, .ff-dialog, .fr-dialog) textarea {
  font-size: var(--sy-operation-font) !important;
}

/* Form and toolbar actions share geometry. Existing action classes own color and state. */
html .sy-admin #storeBody :is(
  .issue-studio :is(.is-submit, [data-ip-next], [data-ip-prev], .is-rule-tools > button, .is-customer-picker .tbtn):not(.ic-pagination button),
  .sy-redeem-form :is(.sy-redeem-actions > .btn, .sy-r-identification .tbtn, .sy-redeem-next),
  .commerce-section:has(.sy-appointment-tools) .commerce-filter > .ghost-btn,
  .sy-appointment-actions > :is(.btn, .ghost-btn),
  .sy-fin-workspace [data-fin-toolbar] :is(.btn, .ghost-btn, .sy-export-button),
  .sy-fin-workspace .ff-search > button[type=submit],
  .sy-fin-workspace .ff-card > header .ff-actions > button,
  .sy-fin-workspace .finance-review :is(.fr-actions, .fr-search-row, .fr-selection-bar) :is(.btn, .ghost-btn, .fr-download)
),
.sy-admin :is(.sy-fin-dialog, .ff-dialog, .fr-dialog) > footer :is(.btn, .ghost-btn) {
  box-sizing: border-box;
  min-height: var(--sy-operation-height) !important;
  height: var(--sy-operation-height) !important;
  padding: 0 12px;
  border-radius: var(--sy-control-radius);
  font-size: var(--sy-operation-action-font, var(--sy-operation-font)) !important;
  line-height: 20px;
}

/* Export is a secondary list action, even in the appointment toolbar. */
html .sy-admin #storeBody .commerce-section:has(.sy-appointment-tools) .commerce-filter > .sy-export-button {
  --sy-operation-action-font: var(--sy-table-heading-size);
}


/* A single baseline for page-level filter and action rows. Wrapping keeps narrow layouts usable. */
body.sy-admin {
  --sy-toolbar-height: 44px;
  --sy-toolbar-control-height: 32px;
  --sy-toolbar-padding: 5px;
  --sy-list-search-width: 280px;
  --sy-list-status-width: 140px;
}

html .sy-admin #storeBody :is(
  .sy-fixed-filter, .an-filters, .sy-business-query, .sy-list-query-unified,
  .sy-config-list-toolbar, .bp-query-bar, .bp-approval-query, .sy-audit-toolbar,
  [data-fin-toolbar], .sy-ws-period, .cp-filters, .sy-appointment-tools, .sy-service-sales-toolbar, .sy-flow-compact-toolbar
) {
  --sy-operation-height: var(--sy-toolbar-control-height);
  box-sizing: border-box;
  height: auto;
  min-height: var(--sy-toolbar-height);
  padding-block: var(--sy-toolbar-padding) !important;
  align-items: center;
  row-gap: 8px;
}

html .sy-admin #storeBody :is(
  .sy-fixed-filter, .an-filters, .sy-business-query, .sy-list-query-unified,
  .sy-config-list-toolbar, .bp-query-bar, .bp-approval-query, .sy-audit-toolbar,
  [data-fin-toolbar], .sy-ws-period, .cp-filters, .sy-appointment-tools, .sy-service-sales-toolbar, .sy-flow-compact-toolbar
) :is(.sy-query-control, .search:has(>input)) {
  --query-height: var(--sy-toolbar-control-height);
  box-sizing: border-box;
  height: var(--sy-toolbar-control-height) !important;
  min-height: var(--sy-toolbar-control-height) !important;
}

html .sy-admin #storeBody :is(
  .sy-fixed-filter, .an-filters, .sy-business-query, .sy-list-query-unified,
  .sy-config-list-toolbar, .bp-query-bar, .bp-approval-query, .sy-audit-toolbar,
  [data-fin-toolbar], .sy-ws-period, .cp-filters, .sy-appointment-tools, .sy-service-sales-toolbar, .sy-flow-compact-toolbar
) :is(
  input:not([type=checkbox],[type=radio],[type=hidden],[type=file]),
  select:not(.sy-select-native), button
):not(:is(.sy-query-control,.search,.sy-range-panel,.flatpickr-calendar,.sy-config-help,.sy-filter-help,.ledger-advanced,.sy-select-popover) *) {
  box-sizing: border-box;
  height: var(--sy-toolbar-control-height) !important;
  min-height: var(--sy-toolbar-control-height) !important;
  padding-block: 0 !important;
}

/* Approval and receipt status filters share one surface and interaction style. */
html .sy-admin #storeBody .sy-status-toolbar {
  display:flex;justify-content:space-between;flex-wrap:wrap;gap:6px 16px;
  padding-inline:18px;margin:0;border-bottom:1px solid var(--sy-border,#e4e9f2);
}
.sy-status-filters{display:flex;align-items:center;flex-wrap:wrap;gap:4px;min-width:0;margin:0}
html .sy-admin #storeBody .sy-status-toolbar .sy-status-filters>button{
  display:inline-flex;align-items:center;justify-content:center;gap:7px;
  width:auto;margin:0;padding-inline:9px;border:0;border-radius:6px;
  color:var(--sy-text-secondary,#606875);background:transparent;
  font-size:var(--sy-table-heading-size,12px);font-weight:400;white-space:nowrap;cursor:pointer;
}
html .sy-admin #storeBody .sy-status-toolbar .sy-status-filters>button:hover{background:var(--sy-surface-alt,#f5f7fb)}
html .sy-admin #storeBody .sy-status-toolbar .sy-status-filters>button[aria-pressed=true]{
  color:var(--sy-primary,#6175fc);background:var(--sy-primary-soft,#eff2ff);font-weight:500;
}
.sy-status-count{
  display:inline-grid;place-items:center;box-sizing:border-box;min-width:18px;height:18px;
  margin:0;padding:0 4px;border-radius:4px;background:var(--sy-surface-alt,#f5f7fb);
  color:var(--sy-muted,#7a8493);font-size:var(--sy-table-meta-size,11px);
  font-weight:400;font-variant-numeric:tabular-nums;
}
.sy-status-filters>[aria-pressed=true]>.sy-status-count{background:transparent}
html .sy-admin #storeBody .sy-status-toolbar>.sy-query-control{
  flex:0 1 var(--sy-list-search-width);width:var(--sy-list-search-width);
  min-width:180px;max-width:100%;margin-left:auto;
}
.sy-status-filters>button:focus-visible,.sy-appointment-segments>button:focus-visible{
  outline:2px solid var(--sy-primary,#6175fc);outline-offset:-2px;
}
@media(max-width:640px){
  html .sy-admin #storeBody .sy-status-toolbar{padding-inline:12px}
  html .sy-admin #storeBody .sy-status-toolbar>.sy-query-control{flex:1 0 100%;min-width:0}
}

/* Orders and configuration lists share a readable search width. */
html .sy-admin #storeBody .bp-query-bar>.fld:has(input){
  flex:0 1 var(--sy-list-search-width);width:var(--sy-list-search-width);min-width:min(100%,220px);
}
html .sy-admin #storeBody .bp-query-bar>.fld>:is(select,.sy-select-trigger){width:var(--sy-list-status-width)}
html .sy-admin #storeBody .sy-business-query>:is(input,.sy-query-control){width:var(--sy-list-search-width)}
@media(max-width:700px){
  html .sy-admin #storeBody .sy-business-query>.sy-query-control{flex:0 1 var(--sy-list-search-width)}
}

/* Keep the appointment filters and view switch close to the list. */
html .sy-admin #storeBody .commerce-section:has(.sy-appointment-tools) .bp-query-bar{margin-bottom:4px}
.sy-appointment-dates{display:flex;align-items:center;flex-wrap:wrap;gap:6px 10px;min-width:0}
.sy-appointment-segments{
  --sy-toolbar-control-height:28px;
  display:inline-flex;align-items:center;flex-wrap:wrap;gap:2px;min-width:0;padding:1px;
  border:1px solid var(--sy-border,#e4e9f2);border-radius:7px;background:var(--sy-surface,#fff);
}
.sy-appointment-tools>.sy-appointment-segments{margin-left:auto}
.sy-appointment-date-error:empty{display:none}
html .sy-admin #storeBody .sy-appointment-tools .sy-appointment-segments>button{
  flex:0 0 auto;width:auto;
  margin:0;padding-inline:10px;border:0;border-radius:5px;background:transparent;
  color:var(--sy-text-secondary,#606875);font-size:var(--sy-table-heading-size,12px);
  line-height:20px;white-space:nowrap;cursor:pointer;
}
html .sy-admin #storeBody .sy-appointment-tools .sy-appointment-segments>button:hover{background:var(--sy-surface-alt,#f5f7fb)}
html .sy-admin #storeBody .sy-appointment-tools .sy-appointment-segments>button[aria-pressed=true]{
  background:var(--sy-primary-soft,#eff2ff);color:var(--sy-primary,#6175fc);font-weight:500;
}
@media(max-width:520px){.sy-appointment-tools>.sy-appointment-segments{margin-left:0}}
