/* FirmaRehberi UI stability layer
   Loaded after the existing style sheets to normalize conflicting layout rules. */
:root {
  --fr-content-max: 1160px;
  --fr-border: #dfe8ef;
  --fr-ink: #172b40;
  --fr-muted: #66798c;
  --fr-primary: var(--primary, #12355b);
  --fr-accent: var(--accent, #11a8a0);
  --fr-card-shadow: 0 8px 28px rgb(19 49 78 / 6%);
  --fr-focus: #168d93;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 104px; text-size-adjust: 100%; }
body { min-width: 320px; max-width: 100%; overflow-x: clip; color: var(--fr-ink); }
main, section, article, aside, form, fieldset, figure, picture, nav, header, footer { min-width: 0; }
img, svg, video, canvas, iframe { max-width: 100%; }
img { height: auto; }
button, input, select, textarea { min-width: 0; max-width: 100%; font: inherit; }
button, input[type="button"], input[type="submit"] { touch-action: manipulation; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid rgb(22 141 147 / 42%);
  outline-offset: 3px;
}
.container { width: min(var(--fr-content-max), calc(100% - 40px)); margin-inline: auto; }
pre, code, .url, [href^="mailto:"], [href^="https://"] { overflow-wrap: anywhere; }
.table-wrap, .admin-table-wrap, .admin-data-table-wrap, .data-table-wrap { max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; }

/* Main navigation: keep links usable and prevent long labels from stretching the header. */
.site-header { isolation: isolate; }
.header-inner { min-width: 0; gap: clamp(12px, 2vw, 24px); }
.header-inner > .brand { min-width: 0; flex: 0 1 auto; }
.brand img { display: block; max-width: 100%; }
.primary-nav { min-width: 0; flex-wrap: wrap; justify-content: flex-end; gap: clamp(8px, 1.35vw, 18px); }
.primary-nav > a, .primary-nav .link-button { overflow-wrap: anywhere; }
.primary-nav .nav-cta { max-width: 100%; white-space: normal; text-align: center; }
@media (min-width: 801px) and (max-width: 1040px) {
  .header-inner { gap: 12px; }
  .brand img { width: 184px; }
  .primary-nav { gap: 9px; }
  .primary-nav > a:not(.btn), .primary-nav .link-button { font-size: .8rem; }
  .primary-nav .nav-cta { padding-inline: 11px; font-size: .79rem; }
}
@media (max-width: 800px) {
  html { scroll-padding-top: 80px; }
  .header-inner { position: relative; min-height: 70px; }
  .primary-nav { max-height: calc(100dvh - 78px); overflow-y: auto; overscroll-behavior: contain; }
  .primary-nav > a, .primary-nav .nav-logout, .primary-nav .nav-logout button { max-width: 100%; }
  .primary-nav .nav-cta { width: 100%; }
}

/* Consistent public cards, forms and responsive grids. */
.content-card, .form-card, .form-aside, .directory-parent-card, .directory-province-card,
.category-card, .business-card, .filter-panel, .ownership-card, .report-card { min-width: 0; }
.content-card, .form-card { overflow-wrap: anywhere; }
.content-card img, .form-card img { max-width: 100%; }
.form-stack > label, .form-grid-2 > label, .form-layout label { min-width: 0; }
.form-stack input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.form-stack select, .form-stack textarea,
.form-grid-2 input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.form-grid-2 select, .form-grid-2 textarea,
.category-search-form input, .directory-index-search input,
.admin-shell input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]),
.admin-shell select, .admin-shell textarea {
  width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box;
}
input, select, textarea { accent-color: var(--fr-accent); }
textarea { max-width: 100%; resize: vertical; }
.category-grid, .province-grid, .business-grid, .search-business-grid,
.directory-parent-grid, .directory-province-grid, .media-grid, .public-media-grid { min-width: 0; }
.category-card, .province-chip, .business-card, .directory-parent-card, .directory-province-card { overflow-wrap: anywhere; }
.category-tree-picker, .category-tree-results, .category-tree-options { min-width: 0; }
.category-tree-results { max-height: min(390px, 52vh); overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.category-tree-group { min-width: 0; }
.category-tree-group > summary { cursor: pointer; overflow-wrap: anywhere; }
.category-tree-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.category-tree-option { min-width: 0; overflow-wrap: anywhere; }
.category-tree-option input { flex: 0 0 auto; }
.category-tree-search { display: flex; align-items: center; min-width: 0; }
.category-tree-search input { width: 100%; min-width: 0; }

/* Business detail: constrain the action strip and avoid full-width stretched buttons. */
.business-detail-hero { min-width: 0; }
.business-detail-hero > .container { padding-top: clamp(22px, 3vw, 36px); padding-bottom: clamp(22px, 3vw, 34px); }
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 9px; min-width: 0; line-height: 1.5; overflow-wrap: anywhere; }
.detail-title-row {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) minmax(170px, auto);
  align-items: center;
  gap: 16px 20px;
  min-width: 0;
}
.detail-logo { width: 104px; height: 104px; min-width: 0; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--fr-border); border-radius: 16px; background: #fff; }
.detail-logo img { width: 100%; height: 100%; object-fit: contain; }
.detail-heading { min-width: 0; width: auto; }
.detail-heading h1 { margin: 5px 0 9px; font-size: clamp(1.45rem, 2.3vw, 2.15rem); line-height: 1.16; letter-spacing: -.025em; overflow-wrap: anywhere; }
.detail-heading > p { margin: 0; line-height: 1.55; overflow-wrap: anywhere; }
.detail-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 10px; }
.detail-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; width: auto; min-width: 0; }
.detail-actions > * { flex: 0 1 auto; min-width: 0; max-width: 100%; }
.detail-actions .btn { min-height: 38px; padding: 8px 11px; border-radius: 10px; font-size: .8rem; line-height: 1.3; }
.business-quick-contact, .business-quick-contact.fr-fast-contact-region {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 8px !important;
  width: min(100%, 620px);
  max-width: 620px;
  margin: 18px 0 0 auto;
  padding: 12px !important;
  border: 1px solid #dce8ef;
  border-radius: 14px;
  background: #fff !important;
  box-shadow: 0 7px 22px rgb(17 45 68 / 5%);
}
.business-quick-contact .quick-contact-label { grid-column: 1 / -1; margin: 0 0 2px; color: #61788a; font-size: .72rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.business-quick-contact .quick-contact-spacer { display: none !important; }
/* Grid items follow a useful contact order; the older flex order values otherwise put mail/site before the phone. */
.business-quick-contact > a { order: 10; }
.business-quick-contact .fr-fast-contact-call { order: 1; }
.business-quick-contact .fr-fast-contact-directions { order: 2; }
.business-quick-contact .fr-fast-contact-whatsapp { order: 3; }
.business-quick-contact .fr-fast-contact-email { order: 4; }
.business-quick-contact .fr-fast-contact-website { order: 5; }
.business-quick-contact .fr-fast-contact-instagram { order: 6; }
.business-quick-contact > a, .business-quick-contact .fr-fast-contact-button {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 9px 10px !important;
  border: 1px solid #d8e4ed;
  border-radius: 10px;
  background: #f8fbfd;
  color: #26465f !important;
  font-size: .84rem;
  font-weight: 800;
  line-height: 1.3;
  text-align: center;
  text-decoration: none !important;
  overflow-wrap: anywhere;
  white-space: normal;
  box-shadow: none !important;
  transform: none;
}
.business-quick-contact > a:hover, .business-quick-contact .fr-fast-contact-button:hover { border-color: #8ecfc8; background: #effbf9; color: #075f5e !important; }
.business-quick-contact > a.quick-contact-primary { background: var(--fr-primary); border-color: var(--fr-primary); color: #fff !important; }
.business-quick-contact > a.quick-contact-primary:hover { background: #174774; border-color: #174774; color: #fff !important; }
.business-quick-contact .fr-fast-contact-call { background: var(--fr-primary); border-color: var(--fr-primary); color: #fff !important; }
.business-quick-contact .fr-fast-contact-call:hover { background: #174774; color: #fff !important; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, 340px); align-items: start; gap: clamp(18px, 2.4vw, 28px); }
.detail-main, .detail-aside { display: grid; align-content: start; gap: 18px; min-width: 0; }
.detail-main > *, .detail-aside > * { min-width: 0; }
.detail-layout .content-card { min-width: 0; padding: clamp(17px, 2vw, 25px); border-radius: 16px; }
.detail-layout .content-card > h2 { font-size: clamp(1.12rem, 1.6vw, 1.4rem); line-height: 1.3; margin-bottom: 14px; }
.detail-layout .prose, .fr-readable-description { color: #30465a; font-size: .98rem; line-height: 1.82; overflow-wrap: anywhere; word-break: normal; }
.detail-layout .prose p, .fr-readable-description > p { margin: 0 0 .85rem; }
.fr-readable-description .fr-description-subheading { margin: 1.3rem 0 .55rem; color: #173d5d; font-size: clamp(1.02rem, 1.6vw, 1.18rem); font-weight: 800; line-height: 1.4; }
.fr-readable-description .fr-description-bullet { position: relative; margin: 0 0 .78rem; padding-left: 1.15rem; }
.fr-readable-description .fr-description-bullet::before { position: absolute; left: 0; color: #087e83; font-weight: 900; content: "•"; }
.fr-readable-description .fr-description-bullet > strong { color: #173d5d; font-weight: 800; }
.fr-readable-description .fr-description-gap { height: .35rem; }
.detail-aside .content-card h2 { font-size: 1.12rem; }
.related-sidebar-item { min-width: 0; }
.related-sidebar-item img { flex: 0 0 auto; object-fit: contain; }
.business-map-embed { width: 100%; height: clamp(190px, 24vw, 260px); overflow: hidden; border-radius: 12px; }
.business-map-embed iframe { display: block; width: 100%; height: 100%; border: 0; }
.media-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.media-grid figure { min-width: 0; margin: 0; }
.media-grid img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; background: #f3f6f8; }
.media-grid figcaption { margin-top: 5px; color: var(--fr-muted); font-size: .75rem; line-height: 1.4; overflow-wrap: anywhere; }

/* Search/list pages, directory indexes and pagination. */
.search-page { min-width: 0; }
.search-results, .result-page, .result-heading, .filter-panel { min-width: 0; }
.filter-panel { align-self: start; }
.directory-index-search { display: grid; grid-template-columns: minmax(140px, .65fr) minmax(0, 2fr) auto; gap: 9px; align-items: center; }
.directory-index-search input { min-height: 44px; padding: 10px 12px; border: 1px solid #cedbe6; border-radius: 10px; background: #fff; }
.directory-parent-grid, .directory-province-grid { align-items: stretch; }
.directory-parent-card { display: flex; flex-direction: column; min-width: 0; }
.directory-province-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; min-width: 0; }
.directory-parent-card .directory-open-link { margin-top: 0; }
.directory-province-card .directory-open-link { margin-top: 0; }
.pagination { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; min-width: 0; }
.pagination a, .pagination .current, .pagination .active, .pagination-dots { flex: 0 0 auto; }
.pagination-summary { flex: 1 1 100%; }

/* Footer and native install dialog: keep text and actions readable on every device. */
.footer-grid { min-width: 0; }
.footer-grid > * { min-width: 0; overflow-wrap: anywhere; }
.footer-bottom { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; min-width: 0; }
.footer-bottom > span { min-width: 0; overflow-wrap: anywhere; }
.footer-engagement { min-width: 0; max-width: 100%; }
.footer-engagement-copy b, .footer-engagement-copy small { overflow-wrap: anywhere; }
.footer-engagement-actions { min-width: 0; }
.footer-engagement-actions .pwa-install-button { max-width: 100%; white-space: normal; }
.app-prompt-overlay { position: fixed; inset: 0; z-index: 2500; display: grid; place-items: center; padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; }
.app-prompt-overlay[hidden] { display: none !important; }
.app-prompt-dialog { width: min(100%, 460px); max-height: min(90dvh, 720px); overflow-y: auto; overscroll-behavior: contain; padding: clamp(20px, 4vw, 32px); border-radius: 20px; }
.app-prompt-icon img { display: block; width: 52px; height: 52px; object-fit: contain; }
.app-prompt-dialog h2 { overflow-wrap: anywhere; }
.app-prompt-dialog p, .app-prompt-note { overflow-wrap: anywhere; }
.app-prompt-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 9px; }
.app-prompt-actions > button { width: 100%; min-width: 0; min-height: 44px; white-space: normal; }

/* Single accessible back-to-top control; both historical IDs use the same styling. */
#fr-back-to-top, #site-scroll-top {
  position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); z-index: 850;
  display: inline-grid; place-items: center; width: 46px; height: 46px; padding: 0;
  border: 1px solid rgb(255 255 255 / 35%); border-radius: 50%; background: var(--fr-primary); color: #fff;
  box-shadow: 0 7px 24px rgb(16 42 61 / 23%); font-size: 1.35rem; font-weight: 900; cursor: pointer;
  transition: background .18s ease, transform .18s ease;
}
#fr-back-to-top:hover, #site-scroll-top:hover { background: var(--fr-accent); color: #083c45; transform: translateY(-2px); }
#fr-back-to-top[hidden], #site-scroll-top[hidden] { display: none !important; }

/* Admin: keep wide tables scrollable, forms compact, and repeated panels aligned. */
.admin-shell { width: min(1480px, calc(100% - 36px)); max-width: 1480px; min-width: 0; margin-inline: auto; }
.admin-shell > *, .admin-panel > *, .admin-columns > *, .admin-management-grid > *, .admin-filter > * { min-width: 0; }
.admin-title { align-items: flex-start; min-width: 0; }
.admin-title h1 { max-width: 100%; font-size: clamp(1.55rem, 2.6vw, 2.1rem); line-height: 1.2; overflow-wrap: anywhere; }
.admin-title p { max-width: 850px; line-height: 1.6; }
.admin-panel { min-width: 0; border-radius: 14px; }
.admin-panel .panel-heading { gap: 12px; align-items: flex-start; }
.admin-panel .panel-heading h2 { margin-bottom: 4px; font-size: clamp(1.03rem, 1.5vw, 1.25rem); line-height: 1.35; overflow-wrap: anywhere; }
.admin-panel .panel-heading p { margin: 0; line-height: 1.5; }
.admin-columns, .settings-columns, .category-admin-columns, .business-detail-columns, .import-columns { min-width: 0; }
.admin-filter, .admin-filter-bar, .slot-filter-toolbar, .slot-filter-toolbar form, .bulk-toolbar, .bulk-slot-toolbar, .slot-manage-info { min-width: 0; }
.admin-filter input, .admin-filter select, .admin-filter-bar input, .admin-filter-bar select { width: 100%; min-width: 0; }
.table-wrap table, .admin-table-wrap table, .admin-data-table { width: 100%; border-collapse: collapse; }
.table-wrap th, .table-wrap td, .admin-table-wrap th, .admin-table-wrap td, .admin-data-table th, .admin-data-table td { vertical-align: middle; overflow-wrap: anywhere; }
.table-wrap th, .admin-table-wrap th, .admin-data-table th { white-space: normal; }
.admin-shell .btn, .admin-panel .btn { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.admin-shell .inline-actions, .admin-shell .bulk-actions, .admin-shell .bulk-toolbar, .admin-shell .bulk-slot-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.admin-shell .inline-actions > *, .admin-shell .bulk-actions > *, .admin-shell .bulk-toolbar > *, .admin-shell .bulk-slot-toolbar > * { min-width: 0; }
.admin-shell details > summary { cursor: pointer; overflow-wrap: anywhere; }
.category-editor-list, .district-editor-list, .batch-list, .ad-request-grid, .slot-groups-list { min-width: 0; }
.category-editor-item, .district-editor-item, .batch-row, .ad-request-card, .slot-group-accordion { min-width: 0; overflow-wrap: anywhere; }
.category-editor-item > summary, .district-editor-item > summary { gap: 8px 14px; }
.category-editor-item > summary > small, .district-editor-item > summary > small { max-width: 100%; text-align: right; overflow-wrap: anywhere; }
.emoji-options { grid-template-columns: repeat(auto-fit, minmax(36px, 1fr)); }
.emoji-options button { min-width: 0; }
.fr-searchable-select { position: relative; display: grid; gap: 6px; min-width: 0; }
.fr-searchable-select > input[type="search"] { width: 100%; min-height: 42px; border: 1px solid #cbd8e3; border-radius: 10px; padding: 9px 12px; background: #fff; }
.fr-search-select-list { position: relative; z-index: 10; max-height: min(320px, 42vh); overflow: auto; border: 1px solid #d8e4ed; border-radius: 10px; background: #fff; box-shadow: 0 8px 24px rgb(19 49 78 / 10%); }
.fr-search-select-option { display: block; width: 100%; padding: 9px 11px; border: 0; border-bottom: 1px solid #eef2f5; border-radius: 0; background: #fff; color: #27445d; text-align: left; cursor: pointer; }
.fr-search-select-option:hover, .fr-search-select-option[aria-selected="true"] { background: #eef9f7; color: #075f5e; }
.fr-search-select-children-group { margin: 4px 0; border-top: 1px solid #eef2f5; }
.fr-search-select-toggle { padding: 7px 11px; color: #526e82; cursor: pointer; }
.fr-search-select-empty { padding: 10px; color: #697d8c; font-size: .82rem; }
.fr-search-select-native { position: absolute !important; width: 1px !important; height: 1px !important; clip: rect(0 0 0 0) !important; clip-path: inset(50%) !important; overflow: hidden !important; white-space: nowrap !important; }
.fr-ad-preview { min-width: 0; margin: 12px 0 18px; padding: 14px; border: 1px solid #dbe6ee; border-radius: 13px; background: #f8fbfd; }
.fr-ad-preview-heading { color: #173d5d; font-size: .94rem; font-weight: 850; }
.fr-ad-preview-description { margin: 5px 0 8px; color: #5b7182; font-size: .83rem; line-height: 1.55; }
.fr-ad-preview-key { display: inline-block; margin-bottom: 10px; padding: 4px 7px; border-radius: 7px; background: #eaf4f8; color: #2c536f; font-size: .72rem; overflow-wrap: anywhere; }
.fr-ad-wireframe { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.fr-ad-wireframe .fr-ad-zone { min-width: 0; min-height: 38px; padding: 7px 5px; border: 1px solid #dce6ee; border-radius: 7px; background: #fff; color: #667c8e; font-size: .68rem; text-align: center; overflow-wrap: anywhere; }
.fr-ad-wireframe .fr-ad-zone.is-active { border-color: #08968d; background: #e8faf6; color: #075f5e; box-shadow: inset 0 0 0 1px #08968d; font-weight: 850; }
.fr-ad-wireframe .fr-ad-zone-main { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .34fr); gap: 5px; }
.fr-ad-wireframe .fr-ad-zone-main .fr-ad-zone { min-height: 60px; }
.fr-ad-wireframe .fr-ad-zone-contact, .fr-ad-wireframe .fr-ad-zone-topstrip, .fr-ad-wireframe .fr-ad-zone-header, .fr-ad-wireframe .fr-ad-zone-nav, .fr-ad-wireframe .fr-ad-zone-hero, .fr-ad-wireframe .fr-ad-zone-footer, .fr-ad-wireframe .fr-ad-zone-popup { grid-column: 1 / -1; }
.fr-collapsible-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.fr-collapsible-heading > button { flex: 0 0 auto; min-height: 32px; padding: 6px 9px; border: 1px solid #d5e2ea; border-radius: 8px; background: #fff; color: #254760; font-size: .76rem; font-weight: 800; cursor: pointer; }
.fr-collapsible-body[hidden] { display: none !important; }
.fr-help-hint { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-inline-start: 6px; border: 1px solid #93b8cc; border-radius: 50%; background: #eef8fb; color: #22546d; font-size: .75rem; font-weight: 900; cursor: pointer; }
.fr-help-popover { display: block; max-width: 38rem; margin-top: 6px; padding: 9px 11px; border: 1px solid #cbdfe8; border-radius: 9px; background: #f3fafc; color: #34586d; font-size: .78rem; font-weight: 500; line-height: 1.55; }
.fr-help-popover[hidden] { display: none !important; }

/* Directory filter has label, query and count columns; stack them before they become cramped. */
@media (max-width: 720px) {
  .directory-index-search { grid-template-columns: minmax(0, 1fr); align-items: stretch; }
  .directory-index-search label { margin-bottom: -4px; }
  .directory-search-count { white-space: normal; }
}

/* Width-aware adjustments: avoid cramped buttons and prevent horizontal page overflow. */
@media (max-width: 1000px) {
  .detail-layout { grid-template-columns: minmax(0, 1fr); }
  .detail-aside { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-aside > .business-map-embed, .detail-aside > .related-sidebar-card, .detail-aside > .report-card { grid-column: auto; }
  .detail-title-row { grid-template-columns: 92px minmax(0, 1fr); align-items: start; }
  .detail-logo { width: 92px; height: 92px; }
  .detail-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .business-quick-contact { margin-right: auto; }
  .category-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .province-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .admin-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .container { width: min(var(--fr-content-max), calc(100% - 28px)); }
  .business-quick-contact, .business-quick-contact.fr-fast-contact-region { margin: 16px 0 0; width: min(100%, 620px); }
  .detail-aside { grid-template-columns: minmax(0, 1fr); }
  .detail-aside > * { grid-column: auto !important; }
  .directory-index-search { grid-template-columns: minmax(0, 1fr); }
  .directory-index-search .btn { width: 100%; }
  .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-shell { width: calc(100% - 24px); padding-top: 18px; }
  .admin-title { flex-direction: column; align-items: stretch; gap: 10px; }
  .admin-title > .btn, .admin-title > a.btn { width: 100%; }
  .admin-columns, .settings-columns, .category-admin-columns, .business-detail-columns, .import-columns { grid-template-columns: minmax(0, 1fr); }
  .admin-filter, .admin-filter-bar, .slot-filter-toolbar { grid-template-columns: minmax(0, 1fr); }
  .admin-filter .btn, .admin-filter-bar .btn { width: 100%; }
  .fr-ad-wireframe { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fr-ad-wireframe .fr-ad-zone-main { grid-template-columns: minmax(0, 1fr) minmax(0, .55fr); }
  .footer-engagement { grid-template-columns: minmax(0, 1fr); }
  .footer-engagement-actions { justify-content: stretch; }
  .footer-engagement-actions .pwa-install-button { flex: 1 1 100%; }
}
@media (max-width: 520px) {
  body { font-size: 14px; }
  .container { width: calc(100% - 26px); }
  .detail-title-row { grid-template-columns: 76px minmax(0, 1fr); gap: 12px; }
  .detail-logo { width: 76px; height: 76px; border-radius: 13px; }
  .detail-heading h1 { font-size: clamp(1.3rem, 5.6vw, 1.65rem); line-height: 1.17; }
  .detail-heading > p { font-size: .82rem; }
  .detail-actions { display: flex; flex-direction: row; align-items: stretch; flex-wrap: wrap; gap: 7px; }
  .detail-actions > * { flex: 1 1 135px; }
  .detail-actions .btn { width: 100%; justify-content: center; }
  .business-quick-contact, .business-quick-contact.fr-fast-contact-region { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 10px !important; gap: 7px !important; }
  .business-quick-contact > a, .business-quick-contact .fr-fast-contact-button { min-height: 42px; padding: 8px 6px !important; font-size: .78rem; }
  .detail-layout .content-card { padding: 16px; }
  .category-grid, .province-grid, .business-grid, .search-business-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .category-card { min-height: 128px; padding: 12px; }
  .category-name { font-size: .82rem; }
  .business-card { padding: 14px; }
  .form-grid-2 { grid-template-columns: minmax(0, 1fr); }
  .category-tree-options { grid-template-columns: minmax(0, 1fr); }
  .category-tree-results { max-height: 45vh; }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-bottom { align-items: stretch; }
  .app-prompt-dialog { padding: 24px 17px 18px; border-radius: 17px; }
  .app-prompt-dialog .app-prompt-close { min-width: 36px; min-height: 36px; }
  .admin-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .admin-stat { min-width: 0; padding: 11px; }
  .admin-shell .btn { min-height: 40px; }
  .table-wrap th, .table-wrap td, .admin-table-wrap th, .admin-table-wrap td, .admin-data-table th, .admin-data-table td { padding: 9px 8px; font-size: .78rem; }
  .category-editor-item > summary > small, .district-editor-item > summary > small { text-align: left; }
}
@media (max-width: 380px) {
  .business-quick-contact, .business-quick-contact.fr-fast-contact-region { grid-template-columns: minmax(0, 1fr); }
  .category-grid, .province-grid, .business-grid, .search-business-grid { grid-template-columns: minmax(0, 1fr); }
  .detail-title-row { grid-template-columns: 64px minmax(0, 1fr); }
  .detail-logo { width: 64px; height: 64px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
