/* Shared Marketcat panel components. Load after tokens.css and before panel styles. */
*, *::before, *::after { box-sizing: border-box; }

.mc-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  grid-template-rows: var(--topbar-height) minmax(0, 1fr);
  color: var(--text);
  background: var(--bg);
  font: var(--weight-regular) var(--text-base)/var(--lh-base) var(--font-sans);
}
.mc-shell .mc-sidebar { position: relative; z-index: auto; inset: auto; width: auto; height: auto; max-height: none; transform: none; visibility: visible; }
.mc-shell .mc-topbar { position: relative; inset: auto; z-index: auto; width: auto; margin: 0; }
.mc-shell .mc-main { width: auto; min-width: 0; margin: 0; float: none; position: relative; }
.mc-shell:has(.mc-shell__frame) { display: block; }
.mc-shell__frame { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
.mc-content-column { min-width: 0; min-height: 100vh; display: flex; flex-direction: column; }
.mc-page-content { flex: 1; min-width: 0; }
.mc-sidebar {
  grid-column: 1;
  grid-row: 1 / -1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-4);
  overflow-y: auto;
  background: var(--bg-subtle);
  border-inline-end: 1px solid var(--border);
}
.mc-shell__frame > .mc-sidebar { grid-column: 1; grid-row: 1; position: relative; z-index: auto; inset: auto; width: auto; height: auto; max-height: none; transform: none; visibility: visible; }
.mc-sidebar-brand { display: flex; align-items: center; gap: var(--space-2); }
.mc-sidebar-search { width: 100%; min-height: var(--control-md); display: flex; align-items: center; gap: var(--space-2); padding-inline: var(--space-2); color: var(--text-secondary); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
.mc-sidebar-search input { flex: 1; min-width: 0; color: var(--text); background: transparent; border: 0; font: inherit; }
.mc-sidebar-search kbd { color: var(--text-tertiary); font: var(--weight-regular) var(--text-xs)/var(--lh-xs) var(--font-mono); }
.mc-sidebar-search::placeholder { color: var(--text-tertiary); }
.mc-user-menu, .mc-profile { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.mc-profile { position: relative; }
.mc-profile-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-sidebar-header, .mc-sidebar-footer, .mc-brand, .mc-topbar, .mc-topbar-actions,
.mc-page-header, .mc-button, .mc-nav-item, .mc-dropdown-toggle {
  display: flex;
  align-items: center;
}
.mc-sidebar-header, .mc-sidebar-footer { justify-content: space-between; gap: var(--space-2); }
.mc-brand { min-width: 0; gap: var(--space-2); color: var(--text); font-weight: var(--weight-semibold); }
.mc-brand img { width: 28px; height: 28px; object-fit: contain; }
.mc-brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-nav { display: flex; flex-direction: column; gap: var(--space-4); margin: 0; padding: 0; list-style: none; }
.mc-nav-group { display: grid; gap: var(--space-1); }
.mc-nav-label { padding: var(--space-1) var(--space-2); color: var(--text-tertiary); font-size: var(--text-xs); font-weight: var(--weight-medium); }
.mc-nav-group-label { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-2); color: var(--text-tertiary); font-size: var(--text-xs); font-weight: var(--weight-medium); }
.mc-extension-badge { display: inline-flex; align-items: center; padding: 0 var(--space-1); color: var(--text-tertiary); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); font-size: var(--text-xs); }
.mc-nav-item {
  min-height: 32px;
  gap: var(--space-2);
  padding: 0 var(--space-2);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  text-decoration: none;
}
/* /admin and /user sidebar tree: flat list of group labels, items and disclosure groups.
   Selectors start with .mc-sidebar so they outrank bootstrap/Atlantis element and single-class rules. */
.mc-sidebar__inner { min-height: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.mc-sidebar .mc-sidebar-brand { min-height: 40px; padding-inline: var(--space-2); color: var(--text); border-radius: var(--radius-md); text-decoration: none; }
.mc-sidebar .mc-sidebar-brand:hover { color: var(--text); background: var(--bg-hover); text-decoration: none; }
.mc-sidebar-brand__mono { width: 24px; height: 24px; flex: 0 0 auto; display: grid; place-items: center; color: var(--accent-contrast); background: var(--accent); border-radius: var(--radius-md); font-size: var(--text-xs); font-weight: var(--weight-semibold); line-height: 1; }
.mc-sidebar-brand__logo { width: auto; max-width: 120px; height: 24px; flex: 0 0 auto; object-fit: contain; }
.mc-sidebar-brand__text { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.mc-sidebar-brand__name { overflow: hidden; color: var(--text); font-size: var(--text-sm); font-weight: var(--weight-semibold); text-overflow: ellipsis; white-space: nowrap; }
.mc-sidebar-brand__sub { color: var(--text-tertiary); font-size: var(--text-xs); }
.mc-sidebar .mc-sidebar-search { min-height: 32px; margin: 0; }
.mc-sidebar .mc-sidebar-search input { height: 30px; padding: 0; outline: none; box-shadow: none; font-size: var(--text-sm); }
.mc-sidebar .mc-sidebar-search input::placeholder { color: var(--text-tertiary); }
.mc-sidebar .mc-sidebar-search kbd { padding: 0 var(--space-1); color: var(--text-tertiary); background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: none; }
.mc-sidebar .sidebar-content { min-height: 0; }
.mc-sidebar .mc-nav--tree { gap: 1px; margin: 0; padding: 0; list-style: none; font-size: var(--text-sm); line-height: var(--lh-sm); }
.mc-sidebar .mc-nav--tree li { margin: 0; list-style: none; }
.mc-sidebar .mc-nav--tree > .mc-nav-group-label { margin-block-start: var(--space-4); padding: var(--space-1) var(--space-2); }
.mc-sidebar .mc-nav--tree > .mc-nav-group-label:first-child { margin-block-start: 0; }
.mc-sidebar .mc-nav--tree > .nav-item > a,
.mc-sidebar .mc-nav--tree .mc-nav-toggle {
  width: 100%;
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 0 var(--space-2);
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  border-radius: var(--radius-md);
  font: inherit;
  text-align: start;
  text-decoration: none;
  cursor: pointer;
}
.mc-sidebar .mc-nav--tree .mc-nav-toggle--sub { min-height: 30px; }
.mc-sidebar .mc-nav--tree > .nav-item > a:hover,
.mc-sidebar .mc-nav--tree .mc-nav-toggle:hover,
.mc-sidebar .mc-nav-sublist a:hover { color: var(--text); background: var(--bg-hover); text-decoration: none; }
.mc-sidebar .mc-nav--tree > .nav-item > a[aria-current="page"],
.mc-sidebar .mc-nav--tree > .nav-item.active > a,
.mc-sidebar .mc-nav-sublist a[aria-current="page"],
.mc-sidebar .mc-nav-sublist > li.active > a { color: var(--text); background: var(--bg-muted); font-weight: var(--weight-medium); }
.mc-sidebar .mc-nav--tree .mc-nav-item-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-nav-chevron { flex: 0 0 auto; color: var(--text-tertiary); transition: transform var(--duration-fast) var(--ease); }
.mc-nav-toggle[aria-expanded="false"] .mc-nav-chevron { transform: rotate(-90deg); }
[dir="rtl"] .mc-nav-toggle[aria-expanded="false"] .mc-nav-chevron { transform: rotate(90deg); }
.mc-nav-sub[hidden] { display: none; }
.mc-sidebar .mc-nav-sublist { display: grid; gap: 1px; margin: 1px 0 var(--space-1); padding: 0; padding-inline-start: 26px; list-style: none; }
.mc-sidebar .mc-nav-sublist .mc-nav-sublist { padding-inline-start: var(--space-3); }
.mc-sidebar .mc-nav-sublist a { min-height: 30px; display: flex; align-items: center; padding: 0 var(--space-2); color: var(--text-secondary); border-radius: var(--radius-md); text-decoration: none; }
.mc-sidebar .mc-nav-sublist .sub-item { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-sidebar [data-mc-nav-hidden] { display: none; }
.mc-avatar { width: 28px; height: 28px; flex: 0 0 auto; display: block; object-fit: cover; background: var(--bg-muted); border-radius: var(--radius-full); }
.mc-nav-item:hover, .mc-nav-item[aria-current="page"] { color: var(--text); background: var(--bg-muted); text-decoration: none; }
.mc-nav-item[aria-current="page"] { font-weight: var(--weight-medium); }
.mc-nav-item :where(svg, .mc-icon) { flex: 0 0 auto; }
.mc-nav-item-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-nav-item-trailing { margin-inline-start: auto; color: var(--text-tertiary); }
.mc-nav-count { margin-inline-start: auto; min-width: 18px; padding-inline: 6px; color: var(--warning); background: var(--warning-subtle); border-radius: var(--radius-full); font: var(--weight-medium) 11px/18px var(--font-mono); text-align: center; }
.mc-nav-divider { border: 0; border-block-start: 1px solid var(--border); margin: var(--space-1) 0; }
.mc-sidebar-footer { margin-block-start: auto; }
.mc-topbar {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  justify-content: space-between;
  gap: var(--space-4);
  padding-inline: var(--space-6);
  background: var(--bg);
  border-block-end: 1px solid var(--border);
}
.mc-breadcrumbs { min-width: 0; overflow: hidden; color: var(--text-secondary); text-overflow: ellipsis; white-space: nowrap; }
.mc-breadcrumb { min-width: 0; overflow: hidden; color: var(--text-secondary); text-overflow: ellipsis; white-space: nowrap; }
.mc-breadcrumbs [aria-current="page"] { color: var(--text); }
.mc-topbar-actions, .mc-topbar__actions { gap: var(--space-2); }
.mc-topbar-start { min-width: 0; display: flex; align-items: center; gap: var(--space-3); }
.mc-locale-form { display: flex; align-items: center; gap: var(--space-1); margin: 0; }
.mc-locale-form .mc-select { width: auto; max-width: 160px; padding-block: 0; font-size: var(--text-sm); }
.mc-topbar__link { min-height: var(--control-md); display: inline-flex; align-items: center; gap: var(--space-2); padding-inline: var(--space-2); color: var(--text-secondary); border-radius: var(--radius-md); text-decoration: none; }
.mc-topbar__link:is(:hover, :focus) { color: var(--text); background: var(--bg-hover); text-decoration: none; }
.mc-icon-button { width: var(--control-md); height: var(--control-md); display: inline-flex; align-items: center; justify-content: center; padding: 0; color: var(--text-secondary); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); cursor: pointer; }
.mc-icon-button:hover { color: var(--text); background: var(--bg-hover); }
.mc-profile__trigger { display: flex; align-items: center; gap: var(--space-2); min-height: var(--control-lg); padding-inline: var(--space-2); color: var(--text); background: transparent; border: 0; border-radius: var(--radius-md); cursor: pointer; }
.mc-profile__menu { position: absolute; z-index: 50; inset-block-start: calc(100% + var(--space-1)); inset-inline-end: 0; min-width: 200px; display: grid; padding: var(--space-1); background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.mc-profile__menu[hidden] { display: none; }
.mc-footer { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding-block: var(--space-4); color: var(--text-tertiary); border-block-start: 1px solid var(--border); font-size: var(--text-xs); }
.mc-main { grid-column: 2; grid-row: 2; min-width: 0; padding: var(--space-8) var(--space-10); }
.mc-content-column > .mc-main { flex: 1; }
.mc-page { width: min(100%, 1120px); margin-inline: auto; }
.mc-page-header { justify-content: space-between; align-items: flex-start; gap: var(--space-4); margin-block-end: var(--space-6); }
.mc-page-title { margin: 0; color: var(--text); font: var(--weight-semibold) var(--text-xl)/var(--lh-xl) var(--font-heading); letter-spacing: var(--tracking-tight); }
.mc-page-description { margin: var(--space-1) 0 0; color: var(--text-secondary); }
.mc-page-actions { display: flex; align-items: center; gap: var(--space-2); }
.mc-content-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: var(--space-4); }

.mc-button, .mc-btn {
  min-height: var(--control-md);
  justify-content: center;
  gap: var(--space-2);
  padding: 0 var(--space-3);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font: var(--weight-medium) var(--text-sm)/var(--lh-sm) var(--font-sans);
  text-align: center;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease), border-color var(--duration-fast) var(--ease), color var(--duration-fast) var(--ease);
}
/* .mc-button gets its flex box from the shared rule above; the .mc-btn alias needs its own or icons sit on the baseline. */
.mc-btn { display: inline-flex; align-items: center; }
:is(.mc-button, .mc-btn) > svg { flex: 0 0 auto; }
.mc-button:hover, .mc-btn:hover { background: var(--bg-hover); text-decoration: none; }
/* Legacy a:hover/a:focus (Atlantis, platform CSS) recolor anchors; pin the text color per variant. */
.mc-button:is(:hover, :focus, :active), .mc-btn:is(:hover, :focus, :active) { color: var(--text); text-decoration: none; }
.mc-button--sm, .mc-btn--sm { min-height: var(--control-sm); padding-inline: var(--space-2); }
.mc-button--lg, .mc-btn--lg { min-height: var(--control-lg); padding-inline: var(--space-4); font-size: var(--text-base); }
.mc-button--primary, .mc-btn--primary { color: var(--accent-contrast); background: var(--accent); border-color: var(--accent); }
.mc-button--primary:hover, .mc-btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.mc-button--primary:is(:hover, :focus, :active), .mc-btn--primary:is(:hover, :focus, :active) { color: var(--accent-contrast); }
.mc-button--secondary, .mc-btn--secondary { color: var(--text); background: var(--surface); border-color: var(--border-strong); }
.mc-button--secondary:is(:hover, :focus-visible, :active), .mc-btn--secondary:is(:hover, :focus-visible, :active) { color: var(--text); background: var(--bg-hover); border-color: var(--border-strong); }
.mc-button--ghost, .mc-btn--ghost { background: transparent; border-color: transparent; }
.mc-button--ghost:is(:hover, :focus, :active), .mc-btn--ghost:is(:hover, :focus, :active) { color: var(--text); border-color: transparent; }
.mc-button--danger, .mc-btn--danger { color: #fff; background: var(--danger-solid); border-color: var(--danger-solid); }
.mc-button--danger:is(:hover, :focus, :active), .mc-btn--danger:is(:hover, :focus, :active) { color: #fff; background: color-mix(in srgb, var(--danger-solid) 88%, #000); border-color: color-mix(in srgb, var(--danger-solid) 88%, #000); }
.mc-button:disabled, .mc-button[aria-disabled="true"], .mc-btn:disabled, .mc-btn[aria-disabled="true"] { color: var(--text-disabled); background: var(--bg-muted); border-color: var(--border); cursor: not-allowed; }
.mc-button:is(:disabled, [aria-disabled="true"]):is(:hover, :focus, :focus-visible, :active), .mc-btn:is(:disabled, [aria-disabled="true"]):is(:hover, :focus, :focus-visible, :active) { color: var(--text-disabled); background: var(--bg-muted); border-color: var(--border); cursor: not-allowed; transform: none; }
.mc-button[aria-busy="true"], .mc-btn[aria-busy="true"] { cursor: progress; }
.mc-icon { width: 1em; height: 1em; flex: 0 0 auto; display: inline-block; vertical-align: middle; }

.mc-field { display: grid; align-content: start; gap: var(--space-1); min-width: 0; }
/* Legacy :where(legend) adds UA inline padding; a legend label lines up with the other labels. */
legend.mc-label { padding: 0; }
.mc-label { margin: 0; color: var(--text); font-size: var(--text-sm); font-weight: var(--weight-medium); }
.mc-input, .mc-select, .mc-textarea {
  width: 100%;
  min-height: var(--control-md);
  padding: var(--space-2) var(--space-3);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font: var(--weight-regular) var(--text-base)/var(--lh-base) var(--font-sans);
}
.mc-textarea { min-height: 96px; resize: vertical; }
.mc-input::placeholder, .mc-textarea::placeholder { color: var(--text-tertiary); }
.mc-input[aria-invalid="true"], .mc-select[aria-invalid="true"], .mc-textarea[aria-invalid="true"] { border-color: var(--danger); }
.mc-help { color: var(--text-secondary); font-size: var(--text-xs); }
.mc-error { color: var(--danger); font-size: var(--text-xs); }
.mc-checkbox, .mc-radio { width: auto; height: auto; min-height: 0; flex: 0 0 auto; margin: 0; padding: 0; accent-color: var(--accent-ui, var(--accent)); }
.mc-choice { margin: 0; display: flex; align-items: flex-start; gap: var(--space-2); color: var(--text); font-weight: var(--weight-regular); }
.mc-switch { width: 32px; height: 18px; min-height: 0; position: relative; display: inline-flex; flex: 0 0 auto; padding: 0; background: var(--border-strong); border: 0; border-radius: var(--radius-full); cursor: pointer; }
.mc-switch::after { content: ""; position: absolute; inset-block-start: 2px; inset-inline-start: 2px; width: 14px; height: 14px; background: var(--surface); border-radius: var(--radius-full); transition: transform var(--duration-fast) var(--ease); }
.mc-switch[aria-checked="true"] { background: var(--accent-ui, var(--accent)); }
.mc-switch[aria-checked="true"]::after { transform: translateX(14px); }
[dir="rtl"] .mc-switch[aria-checked="true"]::after { transform: translateX(-14px); }
.mc-switch:disabled { opacity: .6; cursor: not-allowed; }
input.mc-switch { min-height: 0; margin: 0; appearance: none; -webkit-appearance: none; }
input.mc-switch:checked { background: var(--accent-ui, var(--accent)); }
input.mc-switch:checked::after { transform: translateX(14px); }
[dir="rtl"] input.mc-switch:checked::after { transform: translateX(-14px); }
.mc-segmented { display: inline-flex; max-width: 100%; gap: 2px; padding: 2px; background: var(--bg-muted); border-radius: var(--radius-md); -webkit-user-select: none; user-select: none; }
.mc-segmented > button, .mc-segmented > a, .mc-segmented > label { min-height: var(--control-sm); display: inline-flex; align-items: center; gap: var(--space-1); text-decoration: none; padding-inline: var(--space-3); color: var(--text-secondary); background: transparent; border: 0; border-radius: var(--radius-sm); font: inherit; cursor: pointer; }
.mc-segmented > label { margin: 0; }
.mc-segmented > :is([aria-pressed="true"], [aria-current="true"], [aria-current="page"], [aria-checked="true"], label:has(input:checked)) { color: var(--text); background: var(--surface); box-shadow: 0 0 0 1px var(--border-strong), var(--shadow-sm); font-weight: var(--weight-semibold); }
.mc-segmented > label:has(input:focus-visible) { box-shadow: var(--focus-ring); }

/* The divider is an inset shadow (not a border) so the active 2px underline
   paints over it flush, and overflow-x:auto never clips the underline. */
.mc-tabs { display: flex; gap: var(--space-4); overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; border-block-end: 0; box-shadow: inset 0 -1px 0 var(--border); }
.mc-tab { flex: none; min-height: 40px; display: inline-flex; align-items: center; gap: var(--space-2); margin: 0; padding: 0 var(--space-1); text-decoration: none; color: var(--text-secondary); background: transparent; border: 0; border-block-end: 2px solid transparent; border-radius: 0; box-shadow: none; font: var(--weight-medium) var(--text-sm)/var(--lh-sm) var(--font-sans); white-space: nowrap; cursor: pointer; transform: none; }
.mc-tab:hover { color: var(--text); background: transparent; text-decoration: none; }
.mc-tab:is([aria-selected="true"], [aria-current="page"]) { color: var(--text); border-block-end-color: var(--text); }
.mc-tab:focus-visible { outline: 2px solid var(--accent-ui, var(--accent)); outline-offset: -2px; }
.mc-tab-panel[hidden] { display: none; }
.mc-card { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.mc-card-header, .mc-card-body, .mc-card-footer { padding: var(--space-4); }
.mc-card-header + .mc-card-body, .mc-card-body + .mc-card-footer { border-block-start: 1px solid var(--border); }
.mc-card-title { margin: 0; color: var(--text); font-size: var(--text-md); line-height: var(--lh-md); font-weight: var(--weight-semibold); }
.mc-badge { min-height: 22px; width: fit-content; display: inline-flex; align-items: center; gap: var(--space-1); padding: 0 var(--space-2); color: var(--text-secondary); background: var(--bg-muted); border-radius: var(--radius-full); font-size: var(--text-xs); line-height: var(--lh-xs); white-space: nowrap; }
.mc-badge::before { content: ""; width: 6px; height: 6px; background: currentColor; border-radius: var(--radius-full); }
.mc-badge--success { color: var(--success); background: var(--success-subtle); }
.mc-badge--warning { color: var(--warning); background: var(--warning-subtle); }
.mc-badge--danger { color: var(--danger); background: var(--danger-subtle); }
.mc-badge--accent { color: var(--accent-text); background: var(--accent-subtle); }
.mc-table-wrap { position: relative; max-width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.mc-table-wrap:has(.mc-dropdown-menu:not([hidden]), .mc-row-menu__list:not([hidden])) { overflow: visible; }
.mc-table tbody tr:nth-last-child(-n+2) :is(.mc-dropdown-menu, .mc-row-menu__list) { inset-block: auto calc(100% + var(--space-1)); }
.mc-table-toolbar { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; padding: var(--space-3) var(--space-4); border-block-end: 1px solid var(--border); }
.mc-table-toolbar--selected { background: var(--accent-subtle); }
.mc-table-toolbar__filters, .mc-table-toolbar__actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.mc-table-toolbar__actions { margin-inline-start: auto; }
.mc-table { width: 100%; min-width: 640px; border-collapse: collapse; text-align: start; }
.mc-table th { height: 40px; padding: 0 var(--space-3); color: var(--text-tertiary); background: var(--bg-subtle); font-size: var(--text-xs); font-weight: var(--weight-medium); letter-spacing: normal; text-align: start; text-transform: none; white-space: nowrap; }
.mc-table th.mc-numeric { text-align: end; }
.mc-table td { min-height: 52px; padding: var(--space-3); color: var(--text); border-block-start: 1px solid var(--border); }
.mc-table tbody tr:hover { background: var(--bg-subtle); }
.mc-pagination { display: flex; align-items: center; gap: var(--space-1); margin-inline-start: auto; }
.mc-pagination__summary { color: var(--text-secondary); font-size: var(--text-sm); }
.mc-row-menu { position: relative; }
.mc-row-menu__list { position: absolute; z-index: 50; inset-block-start: calc(100% + var(--space-1)); inset-inline-end: 0; width: 200px; display: grid; padding: var(--space-1); background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.mc-row-menu__list[hidden] { display: none; }
.mc-row-menu__item { width: 100%; min-height: 32px; display: flex; align-items: center; justify-content: flex-start; gap: var(--space-2); padding-inline: var(--space-2); color: var(--text); background: transparent; border: 0; border-radius: var(--radius-sm); text-align: start; text-decoration: none; font: inherit; cursor: pointer; }
.mc-row-menu__item:hover { color: var(--text); background: var(--bg-hover); text-decoration: none; }
.mc-row-menu__item--danger, .mc-row-menu__item--danger:hover { color: var(--danger); }
.mc-row-menu__separator { height: 1px; margin-block: var(--space-1); background: var(--border); }
.mc-numeric { font-variant-numeric: tabular-nums; }
.mc-empty { display: grid; justify-items: center; gap: var(--space-2); padding: var(--space-12) var(--space-4); color: var(--text-secondary); text-align: center; }
.mc-empty-title { margin: 0; color: var(--text); font-weight: var(--weight-semibold); }
.mc-plan-gate, .mc-alert { padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.mc-alert { display: flex; align-items: flex-start; gap: var(--space-2); }
.mc-alert[hidden] { display: none; }
.mc-alert--success { color: var(--success); background: var(--success-subtle); border-color: transparent; }
.mc-alert--warning { color: var(--warning); background: var(--warning-subtle); border-color: transparent; }
.mc-alert--danger { color: var(--danger); background: var(--danger-subtle); border-color: transparent; }
.mc-upload, .mc-dropzone { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); justify-items: center; padding: var(--space-8) clamp(var(--space-4), 4vw, var(--space-8)); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); text-align: center; }
.mc-dropzone input[type="file"], .mc-upload input[type="file"] { width: auto; max-width: 100%; min-width: 0; min-height: 0; padding: 0; background: none; border: 0; color: var(--text-secondary); font: var(--weight-regular) var(--text-sm)/var(--lh-sm) var(--font-sans); }
.mc-dropzone input[type="file"]::file-selector-button, .mc-upload input[type="file"]::file-selector-button { min-height: var(--control-sm); margin-inline-end: var(--space-2); padding-inline: var(--space-3); color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-md); font: var(--weight-medium) var(--text-sm)/var(--lh-sm) var(--font-sans); cursor: pointer; }
.mc-dropzone > *, .mc-upload > * { max-width: 100%; min-width: 0; }
.mc-upload[data-dragging="true"], .mc-dropzone[data-dragging="true"] { border-color: var(--accent); background: var(--accent-subtle); }
.mc-progress { width: 100%; height: 6px; overflow: hidden; background: var(--bg-muted); border-radius: var(--radius-full); }
.mc-progress > span { height: 100%; display: block; background: var(--accent-ui, var(--accent)); border-radius: inherit; }
.mc-editor-toolbar { display: flex; flex-wrap: wrap; gap: var(--space-1); padding: var(--space-2); border: 1px solid var(--border); border-radius: var(--radius-md) var(--radius-md) 0 0; }
.mc-editor-content { min-height: 160px; padding: var(--space-3); border: 1px solid var(--border); border-block-start: 0; border-radius: 0 0 var(--radius-md) var(--radius-md); }
.mc-swatch { width: 28px; height: 28px; border: 1px solid var(--border); border-radius: var(--radius-full); cursor: pointer; }
.mc-swatch[aria-pressed="true"] { outline: 2px solid var(--accent-ui, var(--accent)); outline-offset: 2px; }

.mc-modal-backdrop { position: fixed; z-index: 1000; inset: 0; display: grid; place-items: center; padding: var(--space-6); background: var(--overlay); }
/* display:grid would beat the UA display:none of [hidden] and of a closed <dialog>. A native <dialog> uses .mc-confirm-dialog. */
.mc-modal-backdrop:is([hidden], dialog:not([open])) { display: none; }
.mc-confirm-dialog { width: min(100vw - 32px, 520px); max-width: calc(100vw - 32px); max-height: none; padding: 0; overflow: visible; color: var(--text); border: 0; background: transparent; font: var(--weight-regular) var(--text-base)/var(--lh-base) var(--font-sans); }
.mc-confirm-dialog > .mc-modal { width: 100%; }
.mc-modal-body > p { margin: 0; }
.mc-confirm-dialog::backdrop { background: var(--overlay); }
.mc-modal { width: min(100%, 520px); max-height: min(90vh, 720px); display: flex; flex-direction: column; overflow: auto; color: var(--text); background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); }
.mc-modal-header, .mc-modal-body, .mc-modal-footer { padding: var(--space-4) var(--space-5); }
.mc-modal-header { border-block-end: 1px solid var(--border); }
.mc-modal-header h2 { margin: 0; font-size: var(--text-lg); line-height: var(--lh-lg); }
.mc-modal-footer { display: flex; justify-content: flex-end; gap: var(--space-2); border-block-start: 1px solid var(--border); }
.mc-toast-region { position: fixed; z-index: 1100; inset-inline-end: var(--space-4); inset-block-end: var(--space-4); display: grid; gap: var(--space-2); width: min(360px, calc(100vw - 32px)); }
.mc-toast { padding: var(--space-3) var(--space-4); color: var(--text); background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-md); transition: opacity var(--duration) var(--ease), transform var(--duration) var(--ease); }
.mc-toast[data-dismissed="true"] { opacity: 0; transform: translateY(var(--space-2)); }
.mc-dropdown { position: relative; }
.mc-dropdown-menu { margin: 0; list-style: none; position: absolute; z-index: 50; inset-block-start: calc(100% + var(--space-1)); inset-inline-end: 0; min-width: 180px; display: grid; padding: var(--space-1); background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.mc-dropdown-menu[hidden] { display: none; }
.mc-dropdown-menu :where(a, button:not(.mc-switch)) { min-height: 32px; display: flex; align-items: center; gap: var(--space-2); padding-inline: var(--space-2); color: var(--text); background: transparent; border: 0; border-radius: var(--radius-sm); text-align: start; text-decoration: none; font: inherit; cursor: pointer; }
.mc-dropdown-menu :where(a, button:not(.mc-switch)):hover { background: var(--bg-hover); }
.mc-dropdown-menu :is(a, button:not(.mc-switch), .dropdown-item):is(:hover, :focus, :active) { color: var(--text); background: var(--bg-hover); text-decoration: none; }
.mc-sr-only, .mc-visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.mc-field-help { color: var(--text-secondary); font-size: var(--text-xs); }
.mc-field-error { color: var(--danger); font-size: var(--text-xs); }
.mc-empty-state { display: grid; justify-items: center; gap: var(--space-2); padding: var(--space-12) var(--space-4); color: var(--text-secondary); text-align: center; }
.mc-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.mc-notice { display: flex; align-items: flex-start; gap: var(--space-2); padding: var(--space-3) var(--space-4); color: var(--text); background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.mc-alert--info { color: var(--info); background: var(--info-subtle); border-color: transparent; }
.mc-badge--neutral { color: var(--text-secondary); background: var(--bg-muted); }
.mc-badge--installed, .mc-badge--sent { color: var(--success); background: var(--success-subtle); }
.mc-badge--pending, .mc-badge--queued, .mc-badge--retrying { color: var(--warning); background: var(--warning-subtle); }
.mc-badge--failed, .mc-badge--rejected { color: var(--danger); background: var(--danger-subtle); }
.mc-drawer-overlay { position: fixed; z-index: 800; inset: 0; background: var(--overlay); }
.mc-drawer { overflow-y: auto; background: var(--bg-subtle); }
.mc-drawer-overlay[hidden] { display: none; }
.mc-bottom-nav { display: none; }
:where(button, a, input, select, textarea, [tabindex]):focus-visible { outline: none; box-shadow: var(--focus-ring); }
:where(button, a, input, select, textarea):disabled { cursor: not-allowed; }
/* Legacy Atlantis/Bootstrap still loads for pages not redesigned yet; these keep mc-* shells readable over it. */
:is(.mc-shell, .mc-business) :focus-visible { outline: 2px solid var(--accent-ui, var(--accent)) !important; outline-offset: 2px; }
:is(.mc-shell, .mc-business) label { color: var(--text) !important; font-size: inherit !important; }
/* Label-buttons (<label class="mc-button">) and segments must beat both !important rules: they painted «Subir archivos» dark on the accent. */
:is(.mc-shell, .mc-business) label:is(.mc-button--primary, .mc-btn--primary) { color: var(--accent-contrast) !important; }
:is(.mc-shell, .mc-business) label:is(.mc-button--danger, .mc-btn--danger) { color: #fff !important; }
:is(.mc-shell, .mc-business) .mc-segmented > label:not(:has(input:checked)) { color: var(--text-secondary) !important; }
:is(.mc-shell, .mc-business) .mc-label { font-size: var(--text-sm) !important; }
[data-mode] .card.mc-card { margin-bottom: 0; background: var(--surface); box-shadow: none; }
[data-mode] .form-control:is(.mc-input, .mc-select, .mc-textarea) { color: var(--text); background: var(--surface); border-color: var(--border-strong); }
[data-mode] .table.mc-table :is(td, th) { color: inherit; background: transparent; border-color: var(--border); }
@media (max-width: 1023px) {
  .mc-shell { grid-template-columns: var(--sidebar-rail, 64px) minmax(0, 1fr); }
  .mc-shell__frame { grid-template-columns: var(--sidebar-rail, 64px) minmax(0, 1fr); }
  .mc-sidebar { padding-inline: var(--space-2); }
  .mc-sidebar .mc-nav-label, .mc-sidebar .mc-nav-group-label, .mc-sidebar .mc-nav-item-label, .mc-sidebar .mc-nav-count, .mc-sidebar .mc-sidebar-footer, .mc-sidebar .mc-sidebar-search { display: none; }
  .mc-sidebar-brand { max-width: 48px; justify-content: center; overflow: hidden; white-space: nowrap; }
  .mc-sidebar-brand:has(img) > span, .mc-sidebar-brand:has(.wordmark-mark) > span:not(.wordmark-mark) { display: none; }
  .mc-nav-item { justify-content: center; min-height: 40px; padding-inline: 0; }
  .mc-sidebar .mc-nav--tree > .nav-item > a, .mc-sidebar .mc-nav--tree > .nav-item > .mc-nav-toggle { justify-content: center; padding-inline: 0; }
  .mc-sidebar .mc-nav--tree .mc-nav-chevron, .mc-sidebar .mc-nav--tree .mc-nav-sub, .mc-sidebar .mc-sidebar-brand__text { display: none; }
  .mc-sidebar.mc-drawer[data-open="true"] { position: fixed; z-index: 801; inset-block: 0; inset-inline-start: 0; width: min(var(--sidebar-width), 88vw); display: flex; padding: var(--space-4); border-inline-end: 1px solid var(--border); box-shadow: var(--shadow-md); }
  .mc-sidebar.mc-drawer[data-open="true"] .mc-nav-label, .mc-sidebar.mc-drawer[data-open="true"] .mc-nav-group-label, .mc-sidebar.mc-drawer[data-open="true"] .mc-sidebar-footer { display: flex; }
  .mc-sidebar.mc-drawer[data-open="true"] .mc-sidebar-search { display: flex; }
  .mc-sidebar.mc-drawer[data-open="true"] .mc-sidebar-brand { max-width: none; justify-content: flex-start; }
  .mc-sidebar.mc-drawer[data-open="true"] .mc-sidebar-brand:has(img) > span, .mc-sidebar.mc-drawer[data-open="true"] .mc-sidebar-brand:has(.wordmark-mark) > span:not(.wordmark-mark) { display: initial; }
  .mc-sidebar.mc-drawer[data-open="true"] .mc-nav-item { justify-content: flex-start; padding-inline: var(--space-2); }
  .mc-sidebar.mc-drawer[data-open="true"] .mc-nav--tree > .nav-item > a, .mc-sidebar.mc-drawer[data-open="true"] .mc-nav--tree > .nav-item > .mc-nav-toggle { justify-content: flex-start; padding-inline: var(--space-2); }
  .mc-sidebar.mc-drawer[data-open="true"] .mc-nav-item-label, .mc-sidebar.mc-drawer[data-open="true"] .mc-nav-count, .mc-sidebar.mc-drawer[data-open="true"] .mc-nav--tree .mc-nav-chevron { display: initial; }
  .mc-sidebar.mc-drawer[data-open="true"] .mc-sidebar-brand > .mc-sidebar-brand__text { display: flex; }
  .mc-sidebar.mc-drawer[data-open="true"] .mc-nav--tree .mc-nav-sub:not([hidden]) { display: block; }
  .mc-main { padding: var(--space-6) calc(var(--space-6) + var(--space-1)); }
}
@media (max-width: 899px) {
  .mc-main { padding: var(--space-6) var(--space-4); }
}
@media (max-width: 639px) {
  .mc-shell { display: block; padding-block-start: var(--topbar-height); }
  .mc-shell__frame { min-height: auto; display: block; }
  .mc-sidebar { display: none; }
  .mc-sidebar.mc-drawer { display: none; }
  .mc-sidebar.mc-drawer[data-open="true"] { display: flex; }
  .mc-shell .mc-topbar { position: fixed; z-index: 700; inset-block-start: 0; inset-inline: 0; height: var(--topbar-height); }
  .mc-shell { padding-block-end: calc(60px + env(safe-area-inset-bottom)); }
  .mc-topbar { padding-inline: var(--space-4); }
  .mc-topbar-actions { gap: var(--space-1); }
  .mc-main { padding: var(--space-4) var(--space-4) var(--space-8); }
  .mc-shell .form-group > label { max-inline-size: 100%; white-space: normal; overflow-wrap: anywhere; }
  .mc-page-header { flex-direction: column; }
  .mc-page-actions { width: 100%; }
  .mc-page-actions > * { flex: 1; }
  .mc-bottom-nav { position: fixed; z-index: 700; inset-inline: 0; inset-block-end: 0; min-height: calc(60px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding-block-end: env(safe-area-inset-bottom); background: var(--bg); border-block-start: 1px solid var(--border); }
  .mc-bottom-nav a, .mc-bottom-nav button { display: grid; align-content: center; justify-items: center; gap: 2px; min-width: 0; min-height: 60px; color: var(--text-secondary); background: transparent; border: 0; text-decoration: none; font-size: var(--text-xs); line-height: var(--lh-xs); }
  .mc-bottom-nav [aria-current="page"] { color: var(--accent-text); font-weight: var(--weight-semibold); }
  .mc-modal-backdrop { padding: var(--space-4); }
  .mc-modal { max-height: calc(100vh - 32px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}

/* <x-skeleton> (Negocio v3 Sistema · Estados; Cobros handoff §6.5; replaces loader.gif) and <x-stripe-slot>: the slot
   stays busy with a skeleton until the embedded component starts drawing, and shows the retry error if it cannot
   load. Minimum width 320 px (Supuesto). */
.mc-skeleton { display: flex; flex-direction: column; }
.mc-skeleton :is(.mc-skeleton__thumb, .mc-skeleton__text > span, .mc-skeleton__pill, .mc-skeleton__line, .mc-skeleton__kpi > span, .mc-skeleton__bar) {
  display: block; background: var(--bg-muted); border-radius: var(--radius-sm); animation: mc-skeleton-pulse 1.4s ease-in-out infinite;
}
.mc-skeleton--rows { overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.mc-skeleton__row { display: flex; align-items: center; gap: var(--space-3); min-block-size: var(--row-height, 52px); padding-inline: var(--space-4); border-block-end: 1px solid var(--border); }
.mc-skeleton__row:last-child { border-block-end: 0; }
.mc-skeleton__thumb { flex-shrink: 0; inline-size: 32px; block-size: 32px; }
.mc-skeleton__text { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.mc-skeleton__text > span:first-child { inline-size: 60%; block-size: 9px; }
.mc-skeleton__text > span:last-child { inline-size: 35%; block-size: 7px; }
.mc-skeleton__pill { inline-size: 56px; block-size: 18px; border-radius: var(--radius-full); }
.mc-skeleton--lines { gap: var(--space-2); }
.mc-skeleton__line { block-size: 10px; }
.mc-skeleton__line:last-child:not(:first-child) { inline-size: 60%; }
.mc-skeleton--kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: var(--space-3); }
.mc-skeleton__kpi { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--card-pad, var(--space-4)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.mc-skeleton__kpi > span:first-child { inline-size: 40%; block-size: 9px; }
.mc-skeleton__kpi > span:last-child { inline-size: 60%; block-size: 28px; }
/* An embedded form, and whatever stands in a Stripe slot, is a card. */
:is(.mc-skeleton--form, .mc-stripe-slot > .mc-skeleton) { gap: var(--space-3); padding: var(--space-5); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.mc-skeleton__bar { block-size: var(--control-lg); border-radius: var(--radius-md); }
.mc-skeleton__bar--title { inline-size: 30%; block-size: var(--space-3); border-radius: var(--radius-sm); }
@keyframes mc-skeleton-pulse { 50% { opacity: 0.55; } }
@media (prefers-reduced-motion: reduce) {
  .mc-skeleton * { animation: none !important; }
}
.mc-stripe-slot { inline-size: 100%; min-inline-size: min(100%, 320px); }
.mc-stripe-slot__error { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); padding: var(--space-4); border-radius: var(--radius-lg); background: var(--danger-subtle); color: var(--text); font-size: var(--text-sm); }
