* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Ensure any [hidden] elements are not rendered at all */
[hidden] { display: none !important; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    color: #333;
    background-color: #fff;
    font-size: 14px;
    scrollbar-gutter: stable both-edges;
}

.container {
    max-width: 100%;
    margin: 0;
    padding: 10px;
}

header {
    margin-bottom: 15px;
}

header h1 {
    font-size: 20px;
    color: #333;
    font-weight: 600;
    margin-bottom: 5px;
}

.filters-section {
    margin-bottom: 20px;
    padding: 18px 20px;
    border-radius: 20px;
    border: 1px solid #e4e7ec;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.95), rgba(248, 250, 252, 0.7));
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #475467;
    margin-bottom: 14px;
}

.filters {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sort-section {
    margin-bottom: 20px;
    padding-top: 18px;
    border-top: 1px solid #e4e7ec;
}

.sort-section .section-title {
    margin-bottom: 10px;
}

.filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.filters-search-row {
    gap: 12px;
}

.search-field {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 280px;
    padding: 8px 14px;
    border: 1px solid #d0d5dd;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.search-field .icon {
    width: 16px;
    height: 16px;
    color: #64748b;
}

.search-field input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    background: transparent;
    min-width: 0;
    color: inherit;
}

.search-field input::placeholder {
    color: #98a2b3;
}

.filters-chips-row {
    align-items: stretch;
}

.filter-group {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.chip-group {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 16px;
    border: 1px solid #d0d5dd;
    background: #fff;
    color: #1f2937;
    font-size: 12px;
    line-height: 1.2;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.filter-chip:hover,
.filter-chip:focus-visible {
    border-color: #2563eb;
    color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
    outline: none;
}

.filter-chip.active,
.filter-chip.geo-set,
.filter-chip[aria-pressed="true"] {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.2);
}

.filter-chip:disabled {
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
}

#results-count {
    margin-left: auto;
    font-size: 12px;
    color: #475467;
    white-space: nowrap;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #e4e7ec;
    background: #f8fafc;
}

.filters-active-row {
    padding-top: 0;
}

.active-filters {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.active-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 14px;
    background: #eef2ff;
    color: #3730a3;
    border: 1px solid #c7d2fe;
    font-size: 12px;
}

.active-filter-chip button {
    border: none;
    background: none;
    color: inherit;
    font-size: 14px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.active-filter-chip button:focus-visible {
    outline: 2px solid currentColor;
    border-radius: 50%;
    outline-offset: 2px;
}

/* Quick fix: constrain category tree so it doesn't break layout */
/* Multi-select dropdown with checkboxes */
.ms { position: relative; }
.ms-toggle {
    cursor: pointer;
    font: inherit;
    color: inherit;
}

.ms-toggle.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 16px;
}

.ms-toggle.filter-chip:hover,
.ms-toggle.filter-chip:focus-visible {
    outline: none;
}
.ms-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: min(560px, calc(100vw - 32px));
    max-height: 70vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 0.95fr);
    grid-template-rows: auto minmax(0, 1fr);
    background: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
    z-index: 1000;
    overflow: hidden;
}
.ms-toolbar {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.97), rgba(255,255,255,0.9));
    backdrop-filter: blur(4px);
    z-index: 2;
}
.ms-toolbar-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}
.ms-list {
    grid-column: 1;
    grid-row: 2;
    padding: 8px;
    overflow-y: auto;
}
.ms-category-group {
    padding: 4px 2px;
    border-radius: 12px;
    transition: background-color 0.2s ease;
}

.ms-category-group + .ms-category-group {
    margin-top: 6px;
}

.ms-category-group:hover {
    background: rgba(241, 245, 249, 0.8);
}

.ms-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.ms-item-root {
    background: rgba(241, 245, 249, 0.65);
}

.ms-item-root:hover {
    background: rgba(226, 232, 240, 0.9);
}

.ms-item:hover {
    background: rgba(148, 163, 184, 0.14);
}

.ms-item input {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin-top: 2px;
}

.ms-item-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    padding-left: calc(var(--depth, 0) * 18px);
}

.ms-item-title {
    font-size: 13px;
    font-weight: 500;
    color: #1f2937;
}

.ms-item-root .ms-item-title {
    font-weight: 600;
}

.ms-item-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    align-self: flex-start;
    margin-top: 2px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.15);
    color: #1d4ed8;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.ms-item-hint {
    font-size: 11px;
    color: #94a3b8;
}

.ms-item-count {
    font-size: 12px;
    color: #64748b;
    font-variant-numeric: tabular-nums;
}

.ms-toolbar .ms-search {
    flex: 1;
    min-width: 0;
    font-size: 12px;
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.85);
}

.ms-toolbar .ms-search:focus {
    border-color: #007bff;
}

.ms-reset,
.ms-close {
    font-size: 12px;
    border: none;
    background: transparent;
    color: #475467;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 20px;
    transition: background 0.2s ease, color 0.2s ease;
}

.ms-reset::before {
    content: '\1F5D1';
    margin-right: 4px;
    font-size: 13px;
}

.ms-reset {
    color: #dc2626;
}

.ms-reset:hover,
.ms-reset:focus-visible {
    background: rgba(220, 38, 38, 0.08);
    outline: none;
}

.ms-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    font-size: 18px;
    color: #1f2937;
}

.ms-close:hover,
.ms-close:focus-visible {
    background: rgba(148, 163, 184, 0.15);
    outline: none;
}

.location-browser {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 8px 12px;
    overflow: hidden;
}

.location-level {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 4px;
}


.location-option {
    position: relative;
    display: flex;
    align-items: stretch;
    border: 1px solid #e4e7ec;
    border-radius: 16px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.location-option:hover,
.location-option:focus-within {
    border-color: #2563eb;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.12);
}

.location-option.is-selected {
    border-color: #2563eb;
    background: #fff;
    box-shadow: none;
}

.location-option.is-selected .location-name {
    color: #0f172a;
}

.location-option.is-selected .location-count {
    color: #475569;
}

.location-option-body {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    border-radius: inherit;
}

.location-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 0;
}

.location-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.location-name {
    font-weight: 600;
    color: #0f172a;
    transition: color 0.2s ease;
}

.node-level {
    font-size: 11px;
    color: #64748b;
}

.location-path {
    font-size: 11px;
    color: #94a3b8;
}

.location-count {
    margin-left: auto;
    font-size: 12px;
    color: #475569;
    align-self: center;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}


.location-empty {
    font-size: 12px;
    color: #98a2b3;
    padding: 12px 4px;
}

.ms-footer {
    grid-column: 2;
    grid-row: 1 / span 2;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px 14px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    border-left: 1px solid #eee;
    background: #f8f9fb;
}

.ms-summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 12px;
    min-height: 0;
}

.ms-summary h4 {
    font-size: 12px;
    font-weight: 600;
    color: #1f2933;
}

.ms-selected-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    overflow-y: auto;
    min-height: 0;
}

.ms-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.08);
    color: #1f2937;
    line-height: 1.2;
    border: 1px solid rgba(37, 99, 235, 0.15);
}

.ms-chip .ms-chip-label {
    white-space: nowrap;
}

.ms-chip .ms-chip-remove {
    appearance: none;
    border: none;
    background: transparent;
    color: #1f2937;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    min-width: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.ms-chip .ms-chip-remove:hover,
.ms-chip .ms-chip-remove:focus-visible {
    background: rgba(37, 99, 235, 0.15);
    outline: none;
}

.ms-selected-list li.ms-empty {
    background: transparent;
    color: #98a2b3;
    font-style: italic;
    padding-left: 0;
}

.ms-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(2px);
    z-index: 900;
}

.ms-backdrop[hidden] {
    display: none !important;
}

body.ms-panel-open {
    overflow: hidden;
}

.ms-actions {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ms-cancel,
.ms-apply {
    font-size: 12px;
    border-radius: 999px;
    padding: 6px 12px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.ms-cancel {
    background: #fff;
    border-color: #d0d5dd;
    color: #1f2933;
}

.ms-cancel:hover {
    background: #f2f4f7;
}

.ms-apply {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

.ms-apply:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

@media (max-width: 640px) {
    .ms-panel {
        position: fixed;
        left: 0;
        right: 0;
        top: env(safe-area-inset-top);
        bottom: 0;
        width: auto;
        max-width: none;
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr) auto;
        border-top-left-radius: 16px;
        border-top-right-radius: 16px;
        max-height: calc(100vh - env(safe-area-inset-top));
    }

    .ms-footer {
        grid-column: 1;
        grid-row: 3;
        position: sticky;
        bottom: 0;
        z-index: 3;
        border-left: none;
        border-top: 1px solid #eee;
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), #ffffff);
        padding: 12px 16px;
        padding-bottom: calc(18px + env(safe-area-inset-bottom));
        box-shadow: 0 -6px 18px rgba(15, 23, 42, 0.12);
    }

    .ms-toolbar {
        position: sticky;
        top: 0;
    }

    .ms-toolbar-actions {
        margin-left: 0;
    }
}

@media (min-width: 769px) {
    .sort-section .section-title {
        display: none;
    }
}

.table-container {
    border: 1px solid #ddd;
    background: white;
    overflow-x: auto;
    position: relative;
    scrollbar-gutter: stable both-edges;
    overflow-anchor: none;
}

/* Non-intrusive table loading overlay */
.table-loading {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    font-size: 13px;
    color: #666;
    backdrop-filter: saturate(150%) blur(1px);
    pointer-events: none;
}

.table-loading[hidden] {
    display: none !important;
}

/* Prevent scroll anchoring shifts when tbody content changes */
#restaurants-tbody {
    overflow-anchor: none;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: auto;
}

th, td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
    line-height: 1.5;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #ddd;
    position: sticky;
    top: 0;
    z-index: 10;
    vertical-align: bottom;
}

th[data-sort] {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 20px;
}

th[data-sort]:hover {
    background: #f0f1f2;
}

th[data-sort]::before,
th[data-sort]::after {
    content: "";
    position: absolute;
    right: 8px;
    border: 4px solid transparent;
    opacity: 0.3;
}

th[data-sort]::before {
    border-bottom-color: #333;
    top: 50%;
    margin-top: -9px;
}

th[data-sort]::after {
    border-top-color: #333;
    top: 50%;
    margin-top: 1px;
}

th.sort-asc[data-sort]::before {
    opacity: 1;
}

th.sort-desc[data-sort]::after {
    opacity: 1;
}

tbody tr {
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

tbody tr:nth-child(even) {
    background: #fafbfc;
}

tbody tr:hover {
    background: #fff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
    z-index: 1;
}

.restaurant-name {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.restaurant-name-text {
    font-weight: 600;
    color: #2b2b2b;
    font-size: 14px;
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    line-height: 1.5;
    max-height: calc(1.5em * 3);
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: auto;
}

.restaurant-category {
    background: #e3f2fd;
    color: #1565c0;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    display: inline-block;
    text-transform: uppercase;
    font-weight: 500;
}

.restaurant-address {
    color: #4a4a4a;
    font-size: 13px;
    line-height: 1.5;
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    max-height: calc(1.5em * 3);
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: auto;
}
@media (min-width: 1200px) {
    .restaurant-name-text,
    .restaurant-address {
        -webkit-line-clamp: 4;
        max-height: calc(1.5em * 4);
    }
}

@media (min-width: 1600px) {
    .restaurant-name-text,
    .restaurant-address {
        -webkit-line-clamp: 5;
        max-height: calc(1.5em * 5);
    }
}

.rating {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: center;
}

.rating-cell {
    text-align: center;
    vertical-align: middle;
}

.reviews-cell {
    text-align: center;
    vertical-align: middle;
}

.rating-stars {
    color: #ffa726;
    font-size: 14px;
}

.rating-number {
    font-weight: 600;
    color: #333;
}

.reviews-count {
    color: #666;
    font-size: 11px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.hours {
    font-size: 11px;
    color: #333;
    max-width: 220px;
    vertical-align: middle;
}

.hours-open {
    color: #2e7d32;
    font-weight: 500;
}

.hours-closed {
    color: #c62828;
    font-weight: 500;
}

.hours-content {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    line-height: 1.4;
}

.hours-status {
    font-weight: 600;
}

.hours-range {
    color: #555;
    white-space: normal;
}

.phone {
    font-size: 11px;
}

.phone a {
    color: #1976d2;
    text-decoration: none;
}

.phone a:hover {
    text-decoration: underline;
}

.links {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.link-item {
    padding: 1px 5px;
    background: #f5f5f5;
    border-radius: 3px;
    font-size: 10px;
    text-decoration: none;
    color: #333;
    font-weight: 500;
    text-transform: uppercase;
    border: 1px solid #ddd;
}

.link-item:hover {
    background: #e0e0e0;
    text-decoration: none;
}

.link-website { color: #1976d2; }
.link-instagram { color: #e91e63; }
.link-facebook { color: #3f51b5; }
.link-tiktok { color: #000; }
.link-twitter { color: #1da1f2; }
.link-youtube { color: #f44336; }
.link-maps { color: #2e7d32; }

/* Compact icon links for table cells */
.link-icons {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    max-height: 48px; /* ~2 rows */
    overflow: hidden;
    line-height: 0; /* eliminate extra baseline space */
}
.link-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #f5f5f5;
    color: #555; /* monochrome by default */
    text-decoration: none;
    font-size: 13px;
}
.link-icon:hover { background: #e0e0e0; }
.link-icon svg { width: 16px; height: 16px; display: block; }
.link-icon:focus-visible { outline: 2px solid #1976d2; outline-offset: 1px; }
.link-icon[data-type="maps"]:hover, .link-icon[data-type="maps"]:focus { color: #2e7d32; }
.link-icon[data-type="website"]:hover, .link-icon[data-type="website"]:focus { color: #1976d2; }
.link-icon[data-type="instagram"]:hover, .link-icon[data-type="instagram"]:focus { color: #e91e63; }
.link-icon[data-type="facebook"]:hover, .link-icon[data-type="facebook"]:focus { color: #1877f2; }
.link-icon[data-type="tiktok"]:hover, .link-icon[data-type="tiktok"]:focus { color: #111; }
.link-icon[data-type="twitter"]:hover, .link-icon[data-type="twitter"]:focus { color: #1da1f2; }
.link-icon[data-type="youtube"]:hover, .link-icon[data-type="youtube"]:focus { color: #f44336; }
.link-icon[data-type="phone"]:hover, .link-icon[data-type="phone"]:focus { color: #2e7d32; }
.link-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 22px;
    min-width: 22px;
    padding: 0 6px;
    border: 1px dashed #ccc;
    border-radius: 6px;
    color: #666;
    font-size: 11px;
}
.link-more { cursor: pointer; background: #fff; }
.link-more:focus-visible { outline: 2px solid #1976d2; outline-offset: 1px; }

/* Popover for extra links */
.link-popover {
    position: fixed; /* portal to body */
    z-index: 2000;
    background: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    border-radius: 8px;
    padding: 8px;
    display: grid;
    grid-template-columns: repeat(6, 24px);
    gap: 6px;
    transform-origin: top center;
    animation: popin 80ms ease-out;
    max-height: 50vh;
    overflow: auto;
}
@keyframes popin {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.loading, .no-results {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

/* Column proportions for compact view */
#restaurants-table col.col-name { width: 46%; }
#restaurants-table col.col-distance { width: 12%; }
#restaurants-table col.col-rating { width: 10%; }
#restaurants-table col.col-reviews { width: 8%; }
#restaurants-table col.col-hours { width: 12%; }
#restaurants-table col.col-phone { width: 6%; }
#restaurants-table col.col-links { width: 6%; }

@media (min-width: 1024px) {
    #restaurants-table {
        table-layout: auto;
    }

    #restaurants-table col.col-name {
        width: auto;
        min-width: 320px;
    }

    #restaurants-table col.col-distance { width: 110px; }
    #restaurants-table col.col-rating { width: 110px; }
    #restaurants-table col.col-reviews { width: 100px; }
    #restaurants-table col.col-hours { width: 190px; }
    #restaurants-table col.col-phone { width: 130px; }
    #restaurants-table col.col-links { width: 130px; }
}

@media (min-width: 1440px) {
    #restaurants-table col.col-name {
        min-width: 380px;
    }

    #restaurants-table col.col-rating { width: 110px; }
    #restaurants-table col.col-reviews { width: 110px; }
    #restaurants-table col.col-hours { width: 190px; }
    #restaurants-table col.col-phone { width: 130px; }
    #restaurants-table col.col-links { width: 130px; }
}

@media (min-width: 1680px) {
    #restaurants-table col.col-name {
        min-width: 440px;
    }

    #restaurants-table col.col-hours { width: 210px; }
    #restaurants-table col.col-phone { width: 140px; }
    #restaurants-table col.col-links { width: 150px; }
}

/* Narrow distance column */
td.distance, th[data-sort="distance"] {
    text-align: right;
    white-space: nowrap;
}

/* Align links column content centrally to avoid odd protrusion */
#restaurants-table td:nth-child(7) { vertical-align: middle; }

/* On narrow desktops, hide the separate phone column (phone stays as icon) */
@media (max-width: 1200px) {
    #restaurants-table th:nth-child(6), #restaurants-table td:nth-child(6) { display: none; }
    #restaurants-table col.col-phone { display: none; }
}

.geo-group {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.geo-chip .icon {
    width: 16px;
    height: 16px;
    color: currentColor;
}

.geo-chip.geo-loading {
    opacity: 0.7;
    pointer-events: none;
}

.geo-chip.geo-error {
    background: #fee2e2;
    border-color: #fecaca;
    color: #b91c1c;
}

.radius-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.radius-quick,
.radius-extra-chips {
    display: inline-flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.radius-more[aria-expanded="true"] {
    background: #1d4ed8;
    color: #fff;
    border-color: #1d4ed8;
}

.radius-extended {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid #e4e7ec;
    border-radius: 14px;
    background: #f8fafc;
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.06);
}

.radius-input {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px dashed #d0d5dd;
    border-radius: 12px;
    background: #fff;
}

.radius-input input {
    width: 80px;
    border: none;
    outline: none;
    font-size: 13px;
    background: transparent;
}

.radius-input-label {
    font-size: 12px;
    color: #667085;
    white-space: nowrap;
}

.radius-input button {
    border: none;
    background: none;
    color: #98a2b3;
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.radius-input button:disabled {
    opacity: 0.4;
    cursor: default;
}

/* Disable iOS data detector underline for addresses/phones in cards */
.card a[x-apple-data-detectors],
.card a[href^="x-apple-data-detectors:"],
.card a[href*="maps.apple.com"],
.card a[href^="tel:"],
.card a[href^="mailto:"] {
    color: inherit !important;
    text-decoration: none !important;
    border-bottom: none !important;
}

/* Mobile cards and sort chips */
.sort-chips { display: none; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid #ddd; border-radius: 16px; background: #f8f9fa; font-size: 12px; cursor: pointer; }
.chip .arrow { font-size: 12px; opacity: 0.8; }
.chip .badge { background: #1976d2; color: #fff; border-radius: 10px; padding: 0 6px; font-size: 11px; }

.cards-list { display: none; }
.card { border: 1px solid #ddd; background: #fff; border-radius: 8px; padding: 10px; margin: 8px 0; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-title { font-weight: 600; font-size: 15px; color: #333; }
.badge-open { color: #2e7d32; background: #e8f5e9; border: 1px solid #c8e6c9; border-radius: 12px; padding: 2px 8px; font-size: 11px; }
.badge-closed { color: #c62828; background: #ffebee; border: 1px solid #ffcdd2; border-radius: 12px; padding: 2px 8px; font-size: 11px; }
.card-sub { display: flex; align-items: center; gap: 6px; color: #666; font-size: 12px; margin-top: 6px; }
.card-sub .rating { gap: 4px; }
.card-sub .rating-stars { font-size: 14px; }
.card-meta { display: flex; align-items: center; gap: 8px; color: #666; font-size: 12px; margin-top: 6px; }
.card-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid #ddd; border-radius: 8px; background: #f5f5f5; text-decoration: none; color: #333; font-size: 14px; }
.icon-btn:hover { background: #e0e0e0; }
.icon-btn .icon { width: 18px; height: 18px; display: block; }

@media (max-width: 768px) {
    .filters-section {
        padding: 16px 14px;
        margin-bottom: 16px;
        border-radius: 18px;
        box-shadow: 0 16px 32px rgba(15, 23, 42, 0.12);
    }

    .section-title {
        font-size: 13px;
        margin-bottom: 12px;
    }

    .sort-section {
        margin-bottom: 18px;
        padding-top: 18px;
        border-top-width: 2px;
    }

    .sort-section .section-title {
        display: block;
    }

    .location-option-body {
        padding: 14px 18px;
    }

    .sort-chips { display: flex; }
    .cards-list { display: block; }
    .table-container { display: none; }
    .filters { gap: 6px; }
    .filters input, .filters select { height: 34px; font-size: 14px; }
    .segmented-geo { height: 34px; }
    .segmented-geo .seg-btn { height: 34px; }
    .segmented-geo .radius-chip { height: 30px; }
    .segmented-geo .radius-input input { height: 30px; }
    .ms-panel {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: env(safe-area-inset-top);
        border-top-left-radius: 16px;
        border-top-right-radius: 16px;
        max-height: calc(100vh - env(safe-area-inset-top));
    }
    .ms-toolbar {
        justify-content: space-between;
        position: sticky;
        top: 0;
        background: #fff;
        flex-wrap: wrap;
        gap: 8px;
    }
    .ms-toolbar .ms-search {
        width: 100%;
    }
    .ms-toolbar-actions {
        width: 100%;
        justify-content: space-between;
        margin-left: 0;
    }
    /* Softer sort chips */
    .chip { padding: 4px 8px; border-color: #e5e5e5; font-size: 13px; }
    .chip .badge { padding: 0 5px; font-size: 10px; }
    /* Bigger tap targets for card icons */
    .icon-btn { width: 44px; height: 44px; }
    .icon-btn .icon { width: 20px; height: 20px; }
    /* Horizontal scroll for sort chips */
    .sort-chips { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
    .sort-chips::-webkit-scrollbar { display: none; }
}