/* RC13 — shared screen-only control spacing. No panel/grid/sidebar changes. */
@media screen {
  /* Date controls are generated by today_buttons.js. The dashboard has its own
     compact, inline calendar; leave its reserved 25px column unchanged. */
  body input[data-id-calendar="1"] { margin-bottom:0 !important; }
  body .id-date-actions { gap:6px; margin-top:6px; margin-bottom:10px; }
  body .dashboard-filter .id-date-actions { margin:0; }

  /* Shared action groups; wrap naturally in narrow panels. */
  .action-row, .row-actions, .id-reset-tools {
    display:flex; flex-wrap:wrap; align-items:center; gap:6px;
  }
  .action-row { margin-top:6px; }
  .row-actions > form { margin:0; }
  .row-actions > a:not(.button) { display:inline-flex; align-items:center; }
  .id-reset-tools { margin:6px 0; }
  .id-reset-tools small { flex-basis:100%; }
  .id-reset-tools small:empty { display:none; }
  body.app-shell .id-password-tools { gap:6px; margin-top:6px; }
  body.app-shell .id-password-tools small:empty { display:none; }

  /* Align search, paging and inline table forms to the controls, not the
     bottom margin of their inputs. Preserve existing grid/column widths. */
  body.app-shell .record-search > label > input,
  body.app-shell .page-size > label > select,
  body.app-shell .inline > select,
  body.app-shell .inline > input:not([type="hidden"]) { margin:2px 0 0 !important; }
  body.app-shell .record-search > label > input { margin-bottom:0; }
  body.app-shell .record-search { align-items:flex-end; gap:6px; }
  body.app-shell .inline { gap:6px; }
  body.app-shell .inline > select,
  body.app-shell .inline > input:not([type="hidden"]) { margin-top:0 !important; }
  body.app-shell .dashboard-actions { gap:6px; }
  body.app-shell .dashboard-filter .compact-date { padding-right:30px; }

  /* Forms and controls that previously had no separation at all. */
  .panel > form + form, .login form + form,
  .panel > .button + form, .panel > form + table,
  .panel .scroll + button, .panel .scroll + .button { margin-top:6px; }
  .panel form > label + button,
  .panel form > input:not([type="hidden"]) + button { margin-top:2px; }
  body.app-shell .panel > form + h2,
  body.app-shell .panel > form + h3 { margin-top:8px; }
  body.app-shell .add-task form.grid2 > label > select,
  body.app-shell .add-task form.grid2 > label > input { margin-bottom:0 !important; }
  .panel form > .check + button { margin-top:0; }
  body.app-shell summary.button {
    min-height:26px; height:26px; padding:2px 8px; line-height:20px;
    font-size:13px; box-sizing:border-box; display:inline-flex; align-items:center;
  }
  /* Login's deliberately larger controls and the calendar day grid are unchanged. */
}

/* RC14 — use the existing .split grid, with the same narrow-screen
   stacking breakpoint as Customers. Keep table overflow inside its panel. */
@media screen {
  body.app-shell .recurring-layout > .panel { min-width:0; align-self:stretch; }
  body.app-shell .recurring-layout > .panel:first-child > form { max-width:402px; }
  body.app-shell .record-search > label { flex:0 1 360px; min-width:min(140px,100%); max-width:100%; }
  body.app-shell input[type="search"] { max-width:360px; }
  body.app-shell .glass-search { max-width:440px; gap:6px; }
  body.app-shell .glass-search input { min-width:0; }
  body.app-shell .feature-intro input[type="search"] { max-width:360px; }
}
@media screen and (max-width:1000px) {
  body.app-shell .recurring-layout { grid-template-columns:minmax(0,1fr); }
}

/* RC15 — equal panel heights within the existing two-column layouts. */
@media screen and (min-width:1001px) {
  body.app-shell .customer-layout > .panel,
  body.app-shell .product-layout > .panel,
  body.app-shell .recurring-layout > .panel { align-self:stretch; min-width:0; }
}

/* RC16 — use the existing glass panel radius everywhere, not the smaller
   dashboard metric radius. Screen only; controls and printed PDFs unchanged. */
@media screen {
  :root { --invd-panel-radius:18px; }
  body .panel, body .metric, body .login details, body .notice, body .error,
  body .feature-item, body.app-shell .dashboard-cards .metric {
    border-radius:var(--invd-panel-radius);
  }
  body .metric > span { font-weight:700; }
  /* Keep the schedule header and pager outside the scrolling table area. */
  body.app-shell .schedule-list { display:flex; flex-direction:column; min-width:0; min-height:0; }
  body.app-shell .schedule-list > :is(h2,.record-search,.record-pager) { flex:0 0 auto; }
  body.app-shell .schedule-list > .schedule-scroll { min-height:0; overflow:auto; max-height:240px; }
  body.app-shell .schedule-scroll thead th { position:sticky; top:0; z-index:1; }
}
@media screen and (min-width:1001px) {
  /* The left form determines the row height. The right panel's record count
     cannot contribute to grid sizing, even when the page size is 250. */
  body.app-shell .recurring-layout > .schedule-list { contain:size; }
  body.app-shell .schedule-list > .schedule-scroll { flex:1 1 0; max-height:none; }
}
