/* Corporate theme overrides for this app (loaded after style.css).
   The source reference lives in www/css/style-firm-source.css. */

:root {
  --ui-bg: #f6f7f9;
  --ui-surface: #ffffff;
  --ui-text: #111827;
  --ui-muted: #6b7280;
  --ui-border: #e5e7eb;

  /* Keep existing app blues for navigation; buttons use corporate palette below. */
  --ui-nav: #33556f;
  --ui-nav-active: #437093;

  --ui-radius: 12px;
  --ui-radius-sm: 10px;

  /* Corporate palette (copied from the other app) */
  --btn-positive-bg: #DB3434;
  --btn-positive-bg-hover: #c92c2c;
  --btn-positive-bg-active: #b91c1c;
  --btn-positive-fg: #ffffff;

  --btn-negative-bg: #7a1f1f;
  --btn-negative-bg-hover: #651717;
  --btn-negative-bg-active: #4c1111;
  --btn-negative-fg: #ffffff;

  --btn-secondary-bg: #e5e7eb;
  --btn-secondary-bg-hover: #d1d5db;
  --btn-secondary-fg: #111827;
  --btn-secondary-border: #d1d5db;

  --ui-success-bg: #dcfce7;
  --ui-success-fg: #15803d;
  --ui-focus: rgba(59, 130, 246, 0.55);
}

/* Toasts (flash messages): floating, auto-dismiss */
.toast-host {
  position: fixed;
  top: calc(var(--header-h, 0px) + var(--menu-h, 0px) + 12px);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: 520px;
  z-index: 2500;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  pointer-events: none;
}

/* Auth pages (login): place toasts lower so they don't sit at the very top */
.auth-page .toast-host {
  top: clamp(40px, 18vh, 180px);
}

.toast {
  pointer-events: auto;
  width: 100%;
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-left-width: 6px;
  border-radius: var(--ui-radius);
  box-shadow: 3px 4px 12px rgba(0, 0, 0, 0.10);
  padding: 10px 12px;
  font-weight: 700;
  line-height: 1.3;
  transform: translateY(0);
  opacity: 1;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-hiding {
  opacity: 0;
  transform: translateY(-6px);
}

.toast--success {
  border-left-color: var(--ui-success-fg);
  color: var(--ui-success-fg);
  background: var(--ui-success-bg);
}

.toast--error,
.toast--danger {
  border-left-color: var(--btn-negative-bg);
  color: var(--btn-negative-bg);
}

.toast--info {
  border-left-color: var(--ui-nav-active);
  color: var(--ui-nav-active);
}

.page-loader {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(246, 247, 249, 0.88);
  backdrop-filter: blur(2px);
  z-index: 4000;
}

.page-loader.is-visible {
  display: flex;
}

.page-loader__panel {
  min-width: 220px;
  max-width: calc(100vw - 32px);
  padding: 22px 24px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(209, 213, 219, 0.95);
  box-shadow: 0 18px 48px rgba(17, 24, 39, 0.14);
  text-align: center;
}

.page-loader__spinner {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border: 4px solid #d9dee7;
  border-top-color: #1d70b8;
  border-radius: 50%;
  animation: page-loader-spin 0.8s linear infinite;
}

.page-loader__text {
  font-size: 16px;
  font-weight: 600;
  color: #445064;
}

@keyframes page-loader-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

html {
  color-scheme: light;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'open_sans', Arial, sans-serif;
  background: var(--ui-bg);
  color: var(--ui-text);
}

body {
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--ui-surface);
  border-bottom: 1px solid var(--ui-border);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

#header > h1 {
  color: var(--ui-nav);
}

#menu {
  background: #e6f0fa;
  border-bottom: 1px solid var(--ui-border);
  position: sticky;
  top: var(--header-h, 0px);
  z-index: 999;
}

/* Navigation remap to corporate “pill” links (without changing HTML)
   Desktop only: on mobile we keep the original collapsible menu behavior. */
@media screen and (min-width: 701px) {
  #menu ul {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding-top: 10px;
    padding-bottom: 10px;
  }
}

/* DataGrid: make action column size to content (desktop) */
@media screen and (min-width: 701px) {
  .datagrid table th.col-action,
  .datagrid table td.col-action {
    width: 1%;
    white-space: nowrap;
  }

  .datagrid table td.col-action .btn,
  .datagrid table td.col-action a,
  .datagrid table td.col-action button {
    white-space: nowrap;
  }
}

/* Customers DataGrid: left-align Company column (Firma) */
@media screen and (min-width: 701px) {
  .datagrid[data-datagrid-name*="gridCustomer-grid"] table td.col-company {
    text-align: left !important;
  }
}

#menu ul li {
  float: none;
}

#menu ul li a {
  height: auto;
  line-height: 20px;
  padding: 8px 12px;
  border-radius: var(--ui-radius-sm);
  color: var(--ui-text);
  border: 1px solid transparent;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

#menu ul li a:hover,
#menu ul li a:focus {
  background: #f3f4f6;
  border-color: var(--ui-border);
  text-decoration: none;
}

#menu ul li a.active {
  background: #e8f0ff;
  border-color: #cfe0ff;
}

/* Mobile menu control should match the light nav bar */
@media screen and (max-width: 700px) {
  #menu span.control {
    color: var(--ui-text);
    text-align: center;
    font-weight: 700;
    display: block;
    padding: 12px 14px;
    line-height: 20px;
    min-height: 44px;
    user-select: none;
    background: #e6f0fa;
  }


  /* Off-canvas drawer from top (mobile) */
  body.menu-open {
    overflow: hidden;
  }

  body.menu-open #menu {
    z-index: 2002;
  }

  .menu-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 1998;
  }

  .menu-overlay.is-open {
    display: block;
  }

  body.menu-open #menu span.control {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    border-bottom: 1px solid var(--ui-border);
  }

  #menu > ul {
    display: block;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    height: auto;
    max-height: 100dvh;
    margin: 0;
    padding: 56px 0 12px 0;
    background: #e6f0fa;
    border-bottom: 1px solid var(--ui-border);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    transform: translateY(-110%);
    transition: transform 0.18s ease;
    z-index: 1999;
  }

  body.menu-open #menu > ul {
    transform: translateY(0);
  }

  #menu > ul > li {
    display: block;
    width: 100%;
    float: none;
  }

  #menu > ul > li a {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    padding: 14px 16px;
    font-size: 16px;
    line-height: 22px;
    min-height: 48px;
    border-bottom: 1px solid var(--ui-border);
  }

  #menu > ul > li:nth-child(odd) > a {
    background: #e6f0fa;
  }

  #menu > ul > li:nth-child(even) > a {
    background: #f3f4f6;
  }
}

@media screen and (max-width: 700px) {
  #content {
    padding-left: 14px;
    padding-right: 14px;
  }
}

#content {
  max-width: none;
  padding-left: 30px;
  padding-right: 30px;
}

/* Tablet: keep desktop layout, but use tighter paddings for more usable space */
@media screen and (min-width: 701px) and (max-width: 1024px) {
  #content {
    padding-left: 20px;
    padding-right: 20px;
  }

  #header {
    padding: 10px 20px;
  }

  #header > h1 {
    font-size: 20px;
  }

  #header #logo img,
  #header #customer_logo img {
    max-height: 56px;
  }
}

/* Header buttons mapped to “chip + logout” feel */
#header .headerButtons {
  display: flex;
  gap: 10px;
  align-items: center;
}

#header .headerButtons .btn {
  border-radius: 999px;
  padding: 8px 12px;
}

#header .headerButtons .btn i {
  opacity: 0.85;
}

/* Header spacing: keep legacy markup, modern layout */
#header {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-auto-rows: auto;
  align-items: center;
  align-content: center;
  column-gap: 16px;
  padding: 10px 30px;
}

#header > h1 {
  grid-column: 2;
  grid-row: 1;
  position: static !important;
  width: auto;
  min-width: 0;
  max-width: 100%;
  padding: 0;
  margin: 0;
  text-align: center;
  line-height: 1.2;
  font-size: 24px;
  font-weight: 700;
}

#header .headerButtons {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  position: static !important;
  right: auto;
  bottom: auto;
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

#header #logo,
#header #customer_logo {
  grid-column: 1;
  grid-row: 1;
  margin-right: 0;
  float: none !important;
}

/* Keep logo height compact so the header doesn't grow unnecessarily */
#header #logo img,
#header #customer_logo img {
  display: block;
  width: auto;
  max-height: 64px;
}

/* Kill legacy line-height around logo (prevents extra white space under it) */
#header #logo h1,
#header #logo h1 a,
#header #customer_logo a {
  display: block;
  line-height: 0;
}

/* style.css sets a tall fixed header logo block; undo that */
#header #customer_logo {
  height: auto;
  line-height: 1;
  padding: 0;
  max-width: 300px;
}

/* Make header buttons visually comparable in size to the title/logo */
#header .headerButtons {
  gap: 12px;
}

#header .headerButtons .btn {
  font-size: 15px;
  padding: 10px 14px;
  line-height: 20px;
  white-space: nowrap;
}

@media screen and (max-width: 1000px) {
  #header > h1 {
    text-align: center;
  }
}

@media screen and (max-width: 700px) {
  #header {
    grid-template-columns: 1fr;
    row-gap: 8px;
    justify-items: center;
    padding: 10px 14px;
  }

  #header #logo,
  #header #customer_logo {
    grid-column: 1;
    grid-row: 1;
    justify-self: center;
  }

  #header > h1 {
    grid-column: 1;
    grid-row: 2;
    text-align: center;
    font-size: 18px;
  }

  #header .headerButtons {
    grid-column: 1;
    grid-row: 3;
    justify-self: center;
    width: 100%;
    max-width: 520px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  #header .headerButtons .btn {
    border-radius: var(--ui-radius);
    min-height: 44px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
  }
}

@media screen and (max-width: 700px) {
  .auth-page {
    padding: 18px 14px;
  }

  .auth-card {
    padding: 18px;
  }

  .auth-logo img {
    height: 44px;
  }

  .auth-title {
    font-size: 18px;
  }
}

/* =========================
   Auth / Login pages
   ========================= */

/* Login layouts include www/css/login.css; this section modernizes it. */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 14px;
}

.auth-page #login {
  width: 100%;
  max-width: 440px;
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  color: inherit;
}

.auth-shell {
  width: 100%;
}

.auth-card {
  border: 1px solid var(--ui-border);
  background: var(--ui-surface);
  border-radius: var(--ui-radius);
  box-shadow: 3px 4px 12px rgba(0, 0, 0, 0.06);
  padding: 22px;
}

.auth-legend {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 2px 0 14px;
}

.auth-logo img {
  display: block;
  width: auto;
  height: 52px;
}

.auth-brand {
  margin-top: 10px;
  text-align: center;
  color: var(--ui-nav);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
}

.auth-title {
  margin: 0 0 14px;
  text-align: center;
  font-size: 20px;
  line-height: 1.2;
  color: var(--ui-text);
}

/* Nette default form renderer outputs a table; normalize to a clean stacked layout */
.auth-page #login form table,
.auth-page #login form tbody,
.auth-page #login form tr,
.auth-page #login form th,
.auth-page #login form td {
  display: block;
  width: 100%;
}

.auth-page #login form table {
  width: 100% !important;
}

.auth-page #login form table th,
.auth-page #login form table td {
  padding: 0;
  width: 100% !important;
}

.auth-page #login form table tr {
  margin: 0 0 14px;
}

.auth-page #login form label {
  display: block;
  font-weight: 600;
  margin: 0 0 6px;
  line-height: 1.2;
}

.auth-page #login input[type='text'],
.auth-page #login input[type='password'] {
  width: 100% !important;
  box-sizing: border-box;
  height: auto;
  padding: 12px 14px;
  font-size: 16px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm);
  outline: none;
}

.auth-page #login input[type='text']:focus,
.auth-page #login input[type='password']:focus {
  border-color: #9ca3af;
  box-shadow: 0 0 0 3px var(--ui-focus);
}

.auth-page #login input[type='submit'] {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  border-radius: 999px;
}

/* Checkbox rows */
.auth-page #login input[type='checkbox'] {
  margin-right: 8px;
}

/* =========================
   Dashboard: GDPR
   ========================= */

/* Legacy style.css caps form textarea widths (770px); for CKEditor we want full-width editor */
.dashboard-gdpr form table {
  width: 100% !important;
}

.dashboard-gdpr form table textarea.ckeditor {
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
}

.dashboard-gdpr .cke,
.dashboard-gdpr .cke_chrome {
  width: 100% !important;
  max-width: none !important;
}

/* CKEditor toolbar: wrap groups based on available width */
.cke .cke_top .cke_toolbox {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
}

.cke .cke_top .cke_toolbar {
  float: none !important;
  display: inline-flex;
  flex: 0 0 auto;
}

.cke .cke_top .cke_toolgroup {
  display: inline-flex;
}

.cke .cke_top .cke_toolbar_separator {
  display: none;
}

/* =========================
   DataGrid + legacy Grido
   ========================= */

/* Page toolbar above grids (center title + right-aligned primary action) */
.page-toolbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin: 0 0 10px;
}

.page-toolbar__title {
  grid-column: 2;
  grid-row: 1;
  margin: 0;
  text-align: center;
}

.page-toolbar__actions {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
}

@media screen and (max-width: 700px) {
  .page-toolbar {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 8px;
  }

  .page-toolbar__title {
    grid-column: 1;
    grid-row: auto;
  }

  .page-toolbar__actions {
    grid-column: 1;
    grid-row: auto;
    justify-self: center;
  }
}

/* Make grids use available width and look like modern tables */
.datagrid,
.grido {
  display: block;
  width: 100%;
  margin: 0 0 36px;
  /* Corporate header tint (match thead for seamless rounded corners) */
  background: #f9d1d2;
  /* No outer border (clean card look) */
  border: none;
  border-radius: var(--ui-radius);
  /* Soft card shadow (down-right) */
  box-shadow: 3px 4px 12px rgba(0, 0, 0, 0.06);
  overflow-x: auto;
  /* Needed so inner cell backgrounds/lines don't "cut" rounded corners */
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

/* Normalize legacy table borders inside grids (grido.css/style.css may add them)
   Do not kill tfoot borders (we need a top separator there). */
.datagrid thead th,
.datagrid tbody td,
.grido thead th,
.grido tbody td {
  border-left: none !important;
  border-top: none !important;
}

/* Vertical column separators (clearer scanability) */
.datagrid thead th,
.grido thead th,
.datagrid tbody td,
.grido tbody td {
  border-right: 1px solid var(--ui-border) !important;
}

.datagrid thead th:last-child,
.grido thead th:last-child,
.datagrid tbody td:last-child,
.grido tbody td:last-child {
  border-right: none !important;
}

.datagrid table,
.grido table {
  width: 100% !important;
  min-width: 900px;
  border-collapse: separate;
  border-spacing: 0;
  /* grido.css adds a full table border + shadow; we want no outer border */
  border: none !important;
  box-shadow: none !important;
  /* grido.css also sets a table radius + white bg; that creates a white arc above the header */
  border-radius: 0 !important;
  background: transparent !important;
}

/* Tablet: slightly lower minimum table width to reduce horizontal scrolling */
@media screen and (min-width: 701px) and (max-width: 1024px) {
  .datagrid table,
  .grido table {
    min-width: 760px;
  }
}

/* Mobile: keep DataGrid tables as tables (style.css makes form tables stack) */
@media screen and (max-width: 700px) {
  #content .datagrid form:not(.grido) table,
  #content .grido form:not(.grido) table {
    display: table !important;
    width: 100% !important;
  }

  #content .datagrid form:not(.grido) table thead,
  #content .grido form:not(.grido) table thead {
    display: table-header-group !important;
  }

  #content .datagrid form:not(.grido) table tbody,
  #content .grido form:not(.grido) table tbody {
    display: table-row-group !important;
  }

  #content .datagrid form:not(.grido) table tr,
  #content .grido form:not(.grido) table tr {
    display: table-row !important;
  }

  #content .datagrid form:not(.grido) table th,
  #content .datagrid form:not(.grido) table td,
  #content .grido form:not(.grido) table th,
  #content .grido form:not(.grido) table td {
    display: table-cell !important;
  }

  /* Mobile: avoid absolute separator overlaying header controls; use row border instead */
  .datagrid table thead::after,
  .grido table thead::after {
    display: none;
  }

  #content .datagrid thead tr:last-child th,
  #content .grido thead tr:last-child th {
    border-bottom: 2px solid var(--ui-border) !important;
  }
}

/* NOTE: DataGrid is rendered with classes "datagrid grido" so legacy grido.css applies.
   grido.css uses padding with !important in thead; we must override with !important too. */
#content .datagrid thead th,
#content .grido thead th {
  background: #f9d1d2;
  color: #374151;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.01em;
  border-bottom: none !important;
  padding: 4px 24px 4px 30px !important;
  line-height: 1.15;
}

/* Lighter divider between column captions and filter inputs */
.datagrid thead tr:first-child:not(:last-child) th,
.grido thead tr:first-child:not(:last-child) th {
  border-bottom: 1px solid rgba(255, 255, 255, 0.9) !important;
}

/* Tighten vertical gap between header captions and filter inputs */
#content .datagrid thead tr:not(.row-group-actions):not(:last-child) th,
#content .grido thead tr:not(.row-group-actions):not(:last-child) th {
  padding-bottom: 2px !important;
}

#content .datagrid thead tr:not(.row-group-actions) + tr:not(.row-group-actions) th,
#content .grido thead tr:not(.row-group-actions) + tr:not(.row-group-actions) th {
  padding-top: 2px !important;
}

/* Full-width separator line between header and data */
.datagrid table thead,
.grido table thead {
  position: relative;
}

.datagrid table thead::after,
.grido table thead::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--ui-border);
}

/* Tablet/touch: iPad Safari sometimes renders the absolute thead separator across the viewport.
   Prefer a normal border on the last header row. */
@media (pointer: coarse), screen and (max-width: 1024px) {
  .datagrid table thead::after,
  .grido table thead::after {
    display: none;
  }

  #content .datagrid thead tr:last-child th,
  #content .grido thead tr:last-child th {
    border-bottom: 2px solid var(--ui-border) !important;
  }
}

/* Header links (sortable columns) should inherit the header look */
.datagrid thead th a,
.grido thead th a {
  color: inherit;
  text-decoration: none;
}

.datagrid thead th a:hover,
.datagrid thead th a:focus,
.grido thead th a:hover,
.grido thead th a:focus {
  color: var(--ui-text);
  text-decoration: none;
}

#content .datagrid tbody td,
#content .grido tbody td {
  background: var(--ui-surface);
  border-bottom: 1px solid var(--ui-border);
  padding: 4px 24px 4px 30px !important;
  vertical-align: middle;
  line-height: 1.2;
  height: auto !important;
}

/* Zebra rows (datagrid + grido): alternating body row backgrounds */
#content .datagrid tbody tr:nth-child(even) td,
#content .grido tbody tr:nth-child(even) td {
  background: var(--ui-bg);
}

/* Hover should win over zebra/TD backgrounds */
#content .datagrid tbody tr:hover td,
#content .grido tbody tr:hover td {
  background: var(--btn-secondary-bg);
}

/* Keep utility columns compact */
#content .datagrid table th.col-checkbox,
#content .datagrid table td.col-checkbox,
#content .grido table th.col-checkbox,
#content .grido table td.col-checkbox,
#content .datagrid table th.col-action,
#content .datagrid table td.col-action,
#content .grido table th.col-action,
#content .grido table td.col-action {
  padding: 4px 12px !important;
  line-height: 1.2;
}

/* DataGrid row actions: keep buttons compact so rows don't become tall */
#content .datagrid tbody td.col-action .btn,
#content .datagrid tbody td.col-action a.btn,
#content .grido tbody td.col-action .btn,
#content .grido tbody td.col-action a.btn {
  padding: 5px 10px;
  font-size: 14px;
  line-height: 18px;
  min-height: 0;
}

#content .datagrid tbody td.col-action .btn i,
#content .grido tbody td.col-action .btn i {
  font-size: 18px;
}

/* Some grids render FontAwesome with .fa (not always just bare i); make sure it scales */
#content .datagrid tbody td.col-action .btn .fa,
#content .grido tbody td.col-action .btn .fa {
  font-size: 18px !important;
}

/* Touch/tablet: action buttons must be tappable (bigger hit area) */
@media (pointer: coarse) {
  #content .datagrid table th.col-action .btn,
  #content .datagrid table th.col-action a.btn,
  #content .datagrid table th.col-action input.btn,
  #content .grido table th.col-action .btn,
  #content .grido table th.col-action a.btn,
  #content .grido table th.col-action input.btn,
  #content .datagrid tbody td.col-action .btn,
  #content .datagrid tbody td.col-action a.btn,
  #content .grido tbody td.col-action .btn,
  #content .grido tbody td.col-action a.btn {
    min-width: 44px;
    min-height: 44px;
    padding: 7px 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
  }

  #content .datagrid tbody td.col-action .btn i,
  #content .grido tbody td.col-action .btn i {
    font-size: 18px;
  }

  #content .datagrid tbody td.col-action .btn .fa,
  #content .grido tbody td.col-action .btn .fa {
    font-size: 18px !important;
  }
}

/* Remove the visual outer bottom edge (keep only inner row separators) */
.datagrid tbody tr:last-child td,
.grido tbody tr:last-child td {
  border-bottom: none !important;
}

/* Keep a bottom row separator even without outer border */

.datagrid tbody tr:hover,
.grido tbody tr:hover {
  background: #f3f4f6;
}

/* Checkbox column (group actions) should be centered */
.datagrid table th.col-checkbox,
.datagrid table td.col-checkbox,
.grido table th.col-checkbox,
.grido table td.col-checkbox {
  text-align: center;
  vertical-align: middle;
}

.datagrid table th.col-checkbox input[type='checkbox'],
.datagrid table td.col-checkbox input[type='checkbox'],
.grido table th.col-checkbox input[type='checkbox'],
.grido table td.col-checkbox input[type='checkbox'] {
  margin: 0;
  float: none;
  display: inline-block;
  vertical-align: middle;
}

.datagrid tfoot td,
.grido tfoot td {
  padding: 12px;
  background: var(--ui-surface);
  border-top: none !important;
  border-bottom: none !important;
}

/* Full-width separator line between data and footer */
.datagrid table tfoot,
.grido table tfoot {
  position: relative;
}

.datagrid table tfoot::before,
.grido table tfoot::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: var(--ui-border);
}

/* Tablet/touch: avoid absolute separator rendering glitches; use a normal border instead */
@media (pointer: coarse), screen and (max-width: 1024px) {
  .datagrid table tfoot::before,
  .grido table tfoot::before {
    display: none;
  }

  .datagrid tfoot td,
  .grido tfoot td {
    border-top: 2px solid var(--ui-border) !important;
  }
}

/* Footer layout: keep the middle truly centered.
   Contributte DataGrid renders: .col-items | .col-pagination | .col-per-page
   Legacy Grido uses: span.operations | span.count | span.paginator */

/* Contributte DataGrid footer */
.datagrid tfoot td.row-grid-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.datagrid tfoot td.row-grid-bottom > .col-items {
  justify-self: start;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.datagrid tfoot td.row-grid-bottom > .col-pagination {
  justify-self: center;
  min-width: 0;
  white-space: nowrap;
}

.datagrid tfoot td.row-grid-bottom > .col-per-page {
  justify-self: end;
  min-width: 0;
  white-space: nowrap;
}

.datagrid tfoot td.row-grid-bottom > .col-per-page .form-select {
  width: auto;
  min-width: 90px;
}

/* Footer per-page select: center the selected text (desktop too) */
#content .datagrid tfoot td.row-grid-bottom > .col-per-page .form-select {
  text-align: center;
  text-align-last: center;
}

/* Legacy Grido footer */
.grido tfoot td {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.grido tfoot td > .grid-footer {
  display: grid;
  /* 4 columns: group-actions | exports | per-page | paginator */
  grid-template-columns: minmax(360px, max-content) max-content minmax(0, 1fr) max-content;
  align-items: center;
  column-gap: 12px;
  font-size: 0.95em;
  white-space: nowrap;
}

.grido tfoot td > .grid-footer > span.operations {
  grid-column: 1;
  justify-self: start;
  float: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  /* Keep the group-action select + OK on one line */
  flex-wrap: nowrap;
  white-space: nowrap;
  min-width: 0;
}

/* Legacy style.css sets selects in form tables to width:100%; undo that for group actions */
#content .grido tfoot td > .grid-footer > span.operations select.form-control {
  width: auto;
  min-width: 140px;
  max-width: 280px;
  flex: 0 1 auto;
}

#content .grido tfoot td > .grid-footer > span.operations input[type='submit'] {
  flex: 0 0 auto;
}

.grido tfoot td > .grid-footer > span.exports {
  grid-column: 2;
  justify-self: start;
  float: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  min-width: 0;
  /* Visually tighten spacing to the group-actions block */
  margin-left: -16px;
}

.grido tfoot td > .grid-footer > span.per-page {
  grid-column: 3;
  justify-self: center;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  white-space: nowrap;
}

.grido tfoot td > .grid-footer > span.paginator {
  grid-column: 4;
  justify-self: end;
  white-space: nowrap;
}

/* Tablet/touch: footer must wrap instead of overlapping.
   Use pointer:coarse so iPad Pro landscape (width > 1024) is covered too. */
@media (pointer: coarse), screen and (max-width: 1024px) {
  /* style.css sets overflow:hidden for .datagrid.grido tfoot td; that clips/worsens layout */
  #content .datagrid.grido table tfoot td,
  #content .grido table tfoot td {
    overflow: visible !important;
  }

  #content .datagrid.grido table tfoot td > .grid-footer,
  #content .grido table tfoot td > .grid-footer {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start !important;
    gap: 10px 12px;
    white-space: normal;
  }

  /* Neutralize legacy float/width rules from grido.css/style.css */
  #content .datagrid.grido table tfoot .grid-footer > span,
  #content .grido table tfoot .grid-footer > span {
    float: none !important;
    width: auto !important;
    max-width: 100%;
  }

  #content .datagrid.grido table tfoot .grid-footer > span.operations,
  #content .grido table tfoot .grid-footer > span.operations {
    flex: 0 1 auto;
    white-space: nowrap;
    flex-wrap: nowrap;
  }

  #content .datagrid.grido table tfoot .grid-footer > span.exports,
  #content .grido table tfoot .grid-footer > span.exports {
    flex: 0 0 auto;
    margin-left: 0 !important;
  }

  /* Export buttons in footer: keep same height, but reduce width */
  #content .datagrid.grido table tfoot .grid-footer > span.exports a.btn,
  #content .grido table tfoot .grid-footer > span.exports a.btn {
    padding-left: 10px;
    padding-right: 10px;
    margin: 0;
  }

  #content .datagrid.grido table tfoot .grid-footer > span.per-page,
  #content .grido table tfoot .grid-footer > span.per-page {
    flex: 1 1 100%;
    justify-content: flex-start;
    text-align: left;
    white-space: normal;
    flex-wrap: wrap;
    margin-left: 0;
  }

  #content .datagrid.grido table tfoot .grid-footer > span.paginator,
  #content .grido table tfoot .grid-footer > span.paginator {
    flex: 1 1 100%;
    display: flex;
    justify-content: center;
    white-space: normal;
  }
}

/* Keep per-page select compact */
.grido tfoot td > .grid-footer > span.per-page .form-control {
  width: auto;
  min-width: 90px;
}

#content .grido tfoot td > .grid-footer > span.per-page select.form-control {
  text-align: center;
  text-align-last: center;
}

/* Inputs inside grids */
.datagrid .form-control,
.grido .form-control {
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm);
  padding: 8px 10px;
  background: #fff;
}

/* Grid column headers: center everywhere (except group-actions row) */
#content .datagrid thead tr:not(.row-group-actions) th,
#content .grido thead tr:not(.row-group-actions) th {
  text-align: center !important;
}

/* Header filter selects: center text + match grid typography
   (override legacy #content form table select from style.css) */
#content .datagrid thead select,
#content .grido thead select {
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.2;
  height: 26px;
  padding: 2px 6px;
  color: var(--ui-text);
  text-align: center;
  text-align-last: center;
}

/* Desktop/tablet: header filter inputs are a bit too low; bump height */
@media screen and (min-width: 701px) {
  #content .datagrid thead select,
  #content .grido thead select {
    height: 30px;
    padding: 4px 8px;
  }
}

#content .datagrid thead select option,
#content .grido thead select option {
  text-align: center;
}

/* Header filter inputs: match select sizing (compact, consistent) */
#content .datagrid thead input[type='text'],
#content .datagrid thead input[type='search'],
#content .datagrid thead input[type='number'],
#content .grido thead input[type='text'],
#content .grido thead input[type='search'],
#content .grido thead input[type='number'] {
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.2;
  height: 26px;
  padding: 2px 6px;
}

@media screen and (min-width: 701px) {
  #content .datagrid thead input[type='text'],
  #content .datagrid thead input[type='search'],
  #content .datagrid thead input[type='number'],
  #content .grido thead input[type='text'],
  #content .grido thead input[type='search'],
  #content .grido thead input[type='number'] {
    height: 30px;
    padding: 4px 8px;
  }
}

/* Date filter input group (calendar icon) */
#content .datagrid thead .datagrid-filter-date input,
#content .grido thead .datagrid-filter-date input {
  height: 26px;
  padding: 2px 6px;
  font-size: 13px;
}

@media screen and (min-width: 701px) {
  #content .datagrid thead .datagrid-filter-date input,
  #content .grido thead .datagrid-filter-date input {
    height: 30px;
    padding: 4px 8px;
  }
}

#content .datagrid thead .datagrid-filter-date .input-group-text,
#content .grido thead .datagrid-filter-date .input-group-text {
  height: 26px;
  padding: 2px 8px;
}

@media screen and (min-width: 701px) {
  #content .datagrid thead .datagrid-filter-date .input-group-text,
  #content .grido thead .datagrid-filter-date .input-group-text {
    height: 30px;
    padding: 4px 10px;
  }
}

.datagrid input[type='text'],
.datagrid input[type='search'],
.datagrid input[type='number'],
.datagrid select,
.datagrid textarea,
.grido input[type='text'],
.grido input[type='search'],
.grido input[type='number'],
.grido select,
.grido textarea {
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm);
  padding: 8px 10px;
  background: #fff;
}

.datagrid .form-control:focus,
.grido .form-control:focus {
  border-color: var(--ui-nav-active);
  box-shadow: 0 0 0 3px var(--ui-focus);
  outline: none;
}

.datagrid input[type='text']:focus,
.datagrid input[type='search']:focus,
.datagrid input[type='number']:focus,
.datagrid select:focus,
.datagrid textarea:focus,
.grido input[type='text']:focus,
.grido input[type='search']:focus,
.grido input[type='number']:focus,
.grido select:focus,
.grido textarea:focus {
  border-color: var(--ui-nav-active);
  box-shadow: 0 0 0 3px var(--ui-focus);
  outline: none;
}

/* ProductMedia standalone detail */
body.product-media-standalone {
  background:
    radial-gradient(circle at top right, rgba(67, 112, 147, 0.12), transparent 26%),
    linear-gradient(180deg, #f8fafc 0%, #f3f6fa 100%);
}

body.product-media-standalone #content {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 48px;
}

body.product-media-standalone .styledText.pm-section {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(207, 216, 227, 0.9);
  border-radius: 20px;
  box-shadow: 0 18px 44px rgba(17, 24, 39, 0.08);
  padding: 24px;
  margin-bottom: 20px;
}

body.product-media-standalone .pm-section h1,
body.product-media-standalone .pm-section h2 {
  margin-top: 0;
  color: #223043;
}

body.product-media-standalone .pm-back-link {
  margin-bottom: 14px;
}

body.product-media-standalone .pm-sync-panel {
  position: relative;
}

body.product-media-standalone .pm-sync-panel.is-running {
  border-color: rgba(67, 112, 147, 0.42);
  box-shadow: 0 18px 44px rgba(29, 112, 184, 0.12);
}

body.product-media-standalone .pm-sync-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

body.product-media-standalone .pm-sync-panel__intro {
  max-width: 760px;
}

body.product-media-standalone .pm-sync-panel__intro h2 {
  margin: 0 0 8px;
}

body.product-media-standalone .pm-sync-panel__intro p {
  margin: 0;
}

body.product-media-standalone .pm-sync-panel__button {
  flex: 0 0 auto;
  min-width: 228px;
}

body.product-media-standalone .pm-sync-panel__button.is-busy {
  cursor: wait;
  opacity: 0.92;
}

body.product-media-standalone .pm-sync-panel__status {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid #dce4ee;
}

body.product-media-standalone .pm-sync-panel__message {
  margin: 0 0 14px;
  font-weight: 600;
  color: #223043;
}

body.product-media-standalone .pm-sync-panel__stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

body.product-media-standalone .pm-sync-panel__stat {
  padding: 13px 14px;
  border-radius: 16px;
  border: 1px solid #dce4ee;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(244, 248, 252, 0.96) 100%);
}

body.product-media-standalone .pm-sync-panel__stat-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64809a;
}

body.product-media-standalone .pm-sync-panel__stat-value {
  margin-top: 6px;
  font-size: 24px;
  line-height: 1.1;
  font-weight: 700;
  color: #183b56;
}

body.product-media-standalone .pm-section--overview {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 24px;
  background: rgba(255, 255, 255, 0.96);
  padding-bottom: 24px;
  align-items: start;
}

body.product-media-standalone .pm-overview-preview,
body.product-media-standalone .pm-overview-content {
  min-width: 0;
}

body.product-media-standalone .pm-overview-preview {
  justify-self: start;
  width: 100%;
}

body.product-media-standalone .pm-overview-content {
  display: grid;
  gap: 18px;
}

body.product-media-standalone .pm-overview-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
}

body.product-media-standalone .pm-product-description {
  padding-top: 4px;
}

body.product-media-standalone .pm-product-description p {
  max-width: none;
}

body.product-media-standalone .pm-inline-upload--full {
  grid-column: 1 / -1;
  border-top: 1px solid #e2e8f0;
  padding-top: 24px;
  margin-top: 4px;
}

body.product-media-standalone .pm-preview-image {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 0;
  height: auto;
  border: 1px solid #d9dee7;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  padding: 10px;
  box-sizing: border-box;
}

body.product-media-standalone .pm-media-timestamps {
  margin-top: 14px;
  display: grid;
  gap: 4px;
  color: #526175;
  font-size: 0.95rem;
}

body.product-media-standalone .pm-preview-action {
  margin: 14px 0 0;
}

body.product-media-standalone .pm-preview-image-link {
  display: inline-block;
  border-radius: 18px;
}

body.product-media-standalone .pm-preview-image-link[title] {
  cursor: pointer;
}

body.product-media-standalone .pm-preview-image-link[title] .pm-preview-image {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

body.product-media-standalone .pm-preview-image-link[title]:hover .pm-preview-image,
body.product-media-standalone .pm-preview-image-link[title]:focus .pm-preview-image {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(24, 59, 86, 0.18);
}

body.product-media-standalone .pm-preview-action a {
  color: #b42318;
  font-weight: 600;
  text-decoration: none;
}

body.product-media-standalone .pm-preview-action a:hover,
body.product-media-standalone .pm-preview-action a:focus {
  text-decoration: underline;
}

body.product-media-standalone .pm-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

body.product-media-standalone .pm-section-heading h2 {
  margin: 0;
}

body.product-media-standalone .pm-open-modal,
body.product-media-standalone .pm-button-secondary {
  display: inline-flex;
  align-items: center;
  border: 1px solid #c6d2df;
  background: #fff;
  color: #183b56;
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

body.product-media-standalone .pm-open-modal:hover,
body.product-media-standalone .pm-open-modal:focus,
body.product-media-standalone .pm-button-secondary:hover,
body.product-media-standalone .pm-button-secondary:focus {
  border-color: #8ea6bc;
}

body.product-media-standalone .pm-product-description__block + .pm-product-description__block {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #dce4ee;
}

body.product-media-standalone .pm-product-description__block p:first-child {
  margin-top: 0;
}

body.product-media-standalone .pm-product-description__block p:last-child {
  margin-bottom: 0;
}

body.product-media-standalone .pm-product-description__block ul,
body.product-media-standalone .pm-product-description__block ol {
  padding-left: 22px;
}

body.product-media-standalone.pm-modal-open {
  overflow: hidden;
}

body.product-media-standalone .pm-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
}

body.product-media-standalone .pm-modal.is-open {
  display: block;
}

body.product-media-standalone .pm-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 20, 30, 0.58);
}

body.product-media-standalone .pm-modal__dialog {
  position: relative;
  width: min(1080px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  margin: 16px auto;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid #cfd8e3;
  background: #f8fbfe;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
}

body.product-media-standalone .pm-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid #dce4ee;
  background: linear-gradient(180deg, #ffffff 0%, #f5f8fb 100%);
}

body.product-media-standalone .pm-modal__header h2 {
  margin: 0;
}

body.product-media-standalone .pm-modal__close {
  border: none;
  background: transparent;
  color: #425466;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

body.product-media-standalone .pm-modal__body {
  padding: 20px 22px 24px;
  max-height: calc(100vh - 120px);
  overflow: auto;
}

body.product-media-standalone .pm-modal-form {
  display: grid;
  gap: 18px;
}

body.product-media-standalone .pm-form-field--editor textarea {
  min-height: 220px;
}

body.product-media-standalone .pm-form-actions--modal {
  justify-content: flex-end;
}

body.product-media-standalone .pm-document-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

body.product-media-standalone .pm-document-list__item {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid #dce4ee;
  background: linear-gradient(180deg, #fbfdff 0%, #f6f9fc 100%);
}

body.product-media-standalone .pm-document-list__main {
  display: grid;
  gap: 6px;
  min-width: 0;
}

body.product-media-standalone .pm-document-list__title,
body.product-media-standalone .pm-document-list__meta {
  margin: 0;
}

body.product-media-standalone .pm-document-list__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  color: #526175;
  font-size: 0.93rem;
}

body.product-media-standalone .pm-document-list__fallback {
  color: var(--ui-muted);
  font-size: 0.92em;
}

body.product-media-standalone .pm-document-list__delete {
  margin-left: auto;
  white-space: nowrap;
}

body.product-media-standalone .pm-upload-intro {
  color: #445064;
}

body.product-media-standalone .pm-upload-form {
  display: grid;
  gap: 18px;
}

body.product-media-standalone .pm-form-field label {
  display: block;
  margin: 0 0 8px;
  font-weight: 700;
  color: #223043;
}

body.product-media-standalone .pm-form-field select,
body.product-media-standalone .pm-form-field input[type='url'],
body.product-media-standalone .pm-form-field input[type='text'],
body.product-media-standalone .pm-form-field textarea,
body.product-media-standalone .pm-form-field input[type='file'] {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #cfd8e3;
  border-radius: 14px;
  background: #fff;
  box-sizing: border-box;
  font: inherit;
  color: var(--ui-text);
}

body.product-media-standalone .pm-form-field input[type='file'] {
  padding: 10px;
}

body.product-media-standalone .pm-form-field select:focus,
body.product-media-standalone .pm-form-field input[type='url']:focus,
body.product-media-standalone .pm-form-field input[type='text']:focus,
body.product-media-standalone .pm-form-field textarea:focus,
body.product-media-standalone .pm-form-field input[type='file']:focus {
  border-color: #8eb2d1;
  box-shadow: 0 0 0 4px rgba(67, 112, 147, 0.14);
  outline: none;
}

body.product-media-standalone .pm-upload-switcher__control {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

body.product-media-standalone .pm-upload-switcher__labels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  border-radius: 18px;
  background: #edf3f8;
}

body.product-media-standalone .pm-upload-switcher__label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 14px;
  font-weight: 700;
  color: #526274;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

body.product-media-standalone #pm-upload-mode-file:checked ~ .pm-upload-switcher__labels label[for='pm-upload-mode-file'],
body.product-media-standalone #pm-upload-mode-link:checked ~ .pm-upload-switcher__labels label[for='pm-upload-mode-link'] {
  background: linear-gradient(135deg, #33556f 0%, #437093 100%);
  color: #fff;
  box-shadow: 0 10px 22px rgba(51, 85, 111, 0.22);
}

body.product-media-standalone .pm-upload-panels {
  position: relative;
}

body.product-media-standalone .pm-upload-panel {
  display: none;
  margin-top: 14px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid #dce4ee;
  background: linear-gradient(180deg, #fbfdff 0%, #f7faff 100%);
}

body.product-media-standalone #pm-upload-mode-file:checked ~ .pm-upload-panels [data-upload-panel='file'],
body.product-media-standalone #pm-upload-mode-link:checked ~ .pm-upload-panels [data-upload-panel='link'] {
  display: block;
}

body.product-media-standalone .pm-upload-note {
  margin: 10px 0 0;
  color: var(--ui-muted);
  font-size: 0.94em;
}

body.product-media-standalone .pm-form-actions {
  display: flex;
  justify-content: flex-start;
}

body.product-media-standalone .pm-form-actions input[type='submit'] {
  min-width: 180px;
  min-height: 44px;
  border-radius: 999px;
}

@media screen and (max-width: 760px) {
  body.product-media-standalone #content {
    padding: 18px 16px 36px;
  }

  body.product-media-standalone .pm-section--overview {
    grid-template-columns: 1fr;
  }

  body.product-media-standalone .pm-preview-image {
    max-width: none;
  }

  body.product-media-standalone .pm-section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  body.product-media-standalone .pm-modal__dialog {
    width: calc(100vw - 16px);
    margin: 8px auto;
    max-height: calc(100vh - 16px);
    border-radius: 18px;
  }
}

@media screen and (max-width: 640px) {
  body.product-media-standalone .styledText.pm-section {
    padding: 18px;
    border-radius: 16px;
  }

  body.product-media-standalone .pm-sync-panel__header {
    flex-direction: column;
  }

  body.product-media-standalone .pm-sync-panel__button {
    width: 100%;
    min-width: 0;
  }

  body.product-media-standalone .pm-sync-panel__stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.product-media-standalone .pm-upload-switcher__labels {
    grid-template-columns: 1fr;
  }

  body.product-media-standalone .pm-document-list__item {
    align-items: flex-start;
  }

  body.product-media-standalone .pm-document-list__delete {
    margin-left: 0;
    width: 100%;
  }
}

@media screen and (min-width: 641px) and (max-width: 960px) {
  body.product-media-standalone .pm-sync-panel__stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Grid action buttons inherit our button system */
.datagrid a.btn,
.grido a.btn {
  white-space: nowrap;
}

/* Let grids breathe from surrounding content */
#content .datagrid,
#content .grido {
  margin-top: 14px;
}

/* Document folder tiles grouping */
#content .folder-filter {
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  padding: 14px 16px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

#content .folder-filter legend {
  color: var(--ui-text);
  padding: 0 6px;
}

#content .folder-filter__tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
/* Folder tiles: keep FontAwesome icons in the same scale as grid action icons */
#content .folder-filter__tiles .btn i,
#content .folder-filter__tiles .btn .fa {
  font-size: 18px;
}

@media (pointer: coarse) {
  #content .folder-filter__tiles .btn i,
  #content .folder-filter__tiles .btn .fa {
    font-size: 22px;
  }
}

@media screen and (max-width: 700px) {
  .datagrid table,
  .grido table {
    min-width: 700px;
  }
}

#content form fieldset {
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  padding: 16px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

#content form fieldset legend {
  color: var(--ui-text);
}

#content form table label {
  color: var(--ui-text);
}

#content form table input[type='text'],
#content form table input[type='password'],
#content form table input[type='number'],
#content form table select,
#content form table textarea {
  border-color: var(--ui-border);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#content form table input[type='text']:focus,
#content form table input[type='password']:focus,
#content form table input[type='number']:focus,
#content form table select:focus,
#content form table textarea:focus {
  border-color: var(--ui-nav-active);
  box-shadow: 0 0 0 3px var(--ui-focus);
  outline: none;
}

/* Buttons */
.btn,
input[type='submit'] {
  border-radius: var(--ui-radius-sm);
  padding: 10px 14px;
  line-height: 20px;
  font-weight: 600;
}

/* Ensure .btn padding/centering also works for span.btn (e.g. signature clear button) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Icon-only buttons should still look like buttons */
.btn > i:first-child:last-child {
  margin: 0;
}

/* Signature clear (trash) button: make it comfortably clickable */
.signatureContainer #signature-pad #clearSignature.btn {
  padding: 10px 12px;
}

/* Checkbox/radio spacing: prevent label text from sticking to the control */
#content form label > input[type='checkbox'],
#content form label > input[type='radio'] {
  margin-right: 8px;
}

#content form table input[type='checkbox'],
#content form table input[type='radio'] {
  margin-right: 8px;
}

/* Default buttons are secondary */
.btn {
  background: var(--btn-secondary-bg);
  color: var(--btn-secondary-fg);
  border: 1px solid var(--btn-secondary-border);
}

.btn:hover,
.btn:focus {
  background: var(--btn-secondary-bg-hover);
  color: var(--btn-secondary-fg);
  text-decoration: none;
}

/* Primary actions */
input[type='submit'],
.btn-blue,
.grid-action-edit {
  background: var(--btn-positive-bg);
  color: var(--btn-positive-fg);
  border: none;
}

input[type='submit']:hover,
.btn-blue:hover,
.grid-action-edit:hover,
input[type='submit']:focus,
.btn-blue:focus,
.grid-action-edit:focus {
  background: var(--btn-positive-bg-hover);
  color: var(--btn-positive-fg);
}

input[type='submit']:active,
.btn-blue:active,
.grid-action-edit:active {
  background: var(--btn-positive-bg-active);
}

/* Danger */
.btn-red,
.btn-danger,
.grid-action-delete {
  background: var(--btn-negative-bg);
  color: var(--btn-negative-fg);
  border: none;
}

/* DataGrid reset button (vendor template uses .reset-filter + .btn-danger) */
#content .datagrid a.reset-filter.btn,
#content .datagrid a.btn.btn-danger,
#content .datagrid a.btn.btn-red,
#content .grido a.reset-filter.btn,
#content .grido a.btn.btn-danger,
#content .grido a.btn.btn-red {
  background: var(--btn-negative-bg);
  color: var(--btn-negative-fg) !important;
  border: none;
}

.btn-red:hover,
.btn-danger:hover,
.grid-action-delete:hover,
.btn-red:focus,
.btn-danger:focus,
.grid-action-delete:focus {
  background: var(--btn-negative-bg-hover);
  color: var(--btn-negative-fg);
}

#content .datagrid a.reset-filter.btn:hover,
#content .datagrid a.btn.btn-danger:hover,
#content .datagrid a.reset-filter.btn:focus,
#content .datagrid a.btn.btn-danger:focus,
#content .datagrid a.btn.btn-red:hover,
#content .datagrid a.btn.btn-red:focus,
#content .grido a.reset-filter.btn:hover,
#content .grido a.btn.btn-danger:hover,
#content .grido a.reset-filter.btn:focus,
#content .grido a.btn.btn-danger:focus,
#content .grido a.btn.btn-red:hover,
#content .grido a.btn.btn-red:focus {
  background: var(--btn-negative-bg-hover);
  color: var(--btn-negative-fg) !important;
}

.btn-red:active,
.btn-danger:active,
.grid-action-delete:active {
  background: var(--btn-negative-bg-active);
}

/* Success */
.btn-green {
  background: var(--ui-success-bg);
  color: var(--ui-success-fg);
  border: 1px solid var(--ui-success-fg);
}

.btn-green:hover,
.btn-green:focus {
  background: var(--ui-success-bg);
  color: var(--ui-success-fg);
}

#warning-notice {
  max-width: 1172px;
  margin: 16px auto;
  padding: 12px 14px;
  border-radius: var(--ui-radius-sm);
  border: 1px solid var(--ui-border);
  background: var(--ui-surface);
}
