/* ==========================================
   NHS WAITING TIMES — POLISHED INFORMATIONAL
   ========================================== */

:root {
    --blue-700: #00157c;
    --blue-800: #001063;
    --blue-50: #eef0f8;
    --blue-100: #d0d5ec;
    --blue-500: #1a3a9e;
    --slate-900: #000f3d;
    --slate-800: #0a1a4a;
    --gray-900: #111827;
    --gray-700: #374151;
    --gray-600: #4b5563;
    --gray-500: #6b7280;
    --gray-400: #9ca3af;
    --gray-300: #d1d5db;
    --gray-200: #e5e7eb;
    --gray-100: #f3f4f6;
    --gray-50: #f9fafb;
    --green-600: #059669;
    --green-100: #d1fae5;
    --amber-600: #d97706;
    --amber-100: #fef3c7;
    --red-600: #dc2626;
    --red-100: #fee2e2;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --card-shadow-hover: 0 4px 12px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.06);
    --radius: 0.75rem;
    --radius-sm: 0.5rem;
}

/* --- Base & Typography --- */
html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--gray-900);
    background: var(--gray-50);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

.container {
    max-width: 1320px;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    color: var(--gray-900);
}

h1 { font-size: 1.75rem; letter-spacing: -0.025em; }
h2 { font-size: 1.15rem; }

a { color: var(--blue-700); }
a:hover { color: var(--blue-800); }

/* --- Navbar --- */
.site-nav {
    background: var(--slate-900);
    padding: 0 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.site-nav .container {
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

.site-nav .navbar-brand {
    padding: 0;
}

.navbar-logo {
    height: 36px;
    width: auto;
}

.site-nav .nav-link {
    color: rgba(255,255,255,0.6) !important;
    font-weight: 500;
    font-size: 0.85rem;
    transition: color 0.15s;
}

.site-nav .nav-link:hover {
    color: #fff !important;
}

.site-nav .nav-link i {
    margin-right: 0.25rem;
    font-size: 0.8rem;
    opacity: 0.7;
}

.site-nav .dropdown-menu {
    background: var(--slate-800);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 0.5rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    padding: 0.4rem 0;
    min-width: 200px;
}

.site-nav .dropdown-item {
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.45rem 1.1rem;
    transition: background 0.12s, color 0.12s;
}

.site-nav .dropdown-item:hover,
.site-nav .dropdown-item:focus {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.site-nav .dropdown-divider {
    border-color: rgba(255,255,255,0.08);
    margin: 0.3rem 0;
}

/* --- Mobile hamburger button --- */
.sidenav-toggle {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 1.5rem;
    padding: 0.25rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.15s;
}
.sidenav-toggle:hover { color: #fff; }

/* --- Side nav overlay --- */
.sidenav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
}
.sidenav-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* --- Side nav panel --- */
.sidenav {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    max-width: 85vw;
    height: 100%;
    background: var(--slate-900);
    z-index: 1050;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.sidenav.open {
    transform: translateX(0);
}

.sidenav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidenav-logo {
    height: 28px;
    width: auto;
}
.sidenav-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    font-size: 1.15rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    transition: color 0.15s;
}
.sidenav-close:hover { color: #fff; }

.sidenav-body {
    padding: 0.75rem 0;
    flex: 1;
}

.sidenav-link {
    display: block;
    padding: 0.7rem 1.25rem;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.12s, color 0.12s;
}
.sidenav-link:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}
.sidenav-link i {
    margin-right: 0.5rem;
    font-size: 0.85rem;
    opacity: 0.7;
    width: 1.1rem;
    display: inline-block;
    text-align: center;
}

.sidenav-group { margin: 0; }

.sidenav-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.7rem 1.25rem;
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    text-align: left;
}
.sidenav-group-toggle:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}
.sidenav-group-toggle i:first-child,
.sidenav-group-toggle span i {
    margin-right: 0.5rem;
    font-size: 0.85rem;
    opacity: 0.7;
    width: 1.1rem;
    display: inline-block;
    text-align: center;
}
.sidenav-chevron {
    font-size: 0.7rem;
    transition: transform 0.25s;
    opacity: 0.5;
}

.sidenav-group-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(0,0,0,0.15);
}
.sidenav-group-items.open {
    max-height: 600px;
}
.sidenav-group-items a {
    display: block;
    padding: 0.5rem 1.25rem 0.5rem 2.85rem;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 400;
    transition: background 0.12s, color 0.12s;
}
.sidenav-group-items a:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}
.sidenav-viewall {
    font-weight: 500 !important;
    color: var(--blue-300, #93c5fd) !important;
    border-top: 1px solid rgba(255,255,255,0.06);
    margin-top: 0.25rem;
    padding-top: 0.6rem !important;
}

.sidenav-divider {
    border-color: rgba(255,255,255,0.08);
    margin: 0.5rem 1.25rem;
}

/* --- Page Hero (Homepage) — full-width, angled bottom --- */
.page-hero {
    width: 100vw;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    background: var(--slate-900);
    border-radius: 0;
    padding: 3.5rem 1.5rem 8rem;
    text-align: center;
    color: #fff;
    margin-top: -1.5rem;
    margin-bottom: 2rem;
}

.page-hero::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 130px;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 1440 130' xmlns='http://www.w3.org/2000/svg' preserveAspectRatio='none'%3E%3Cpath d='M0,50 C360,130 900,-10 1440,90 L1440,130 L0,130 Z' fill='%23f9fafb'/%3E%3C/svg%3E");
    background-size: 100% 100%;
    background-repeat: no-repeat;
}

.page-hero h1 {
    font-size: 2.1rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 0.5rem;
    color: #fff;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.page-hero p {
    font-size: 1rem;
    color: #94a3b8;
    margin-bottom: 0;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.page-hero .hero-search {
    max-width: 480px;
    margin: 1.5rem auto 0;
    position: relative;
}

.page-hero .hero-search input {
    width: 100%;
    border: 1.5px solid rgba(255,255,255,0.12);
    border-radius: var(--radius-sm);
    padding: 0.7rem 1rem 0.7rem 2.75rem;
    font-size: 0.95rem;
    background: rgba(255,255,255,0.06);
    color: #fff;
    transition: border-color 0.15s, background 0.15s;
}

.page-hero .hero-search input::placeholder {
    color: #64748b;
}

.page-hero .hero-search input:focus {
    outline: none;
    border-color: rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.09);
}

.page-hero .hero-search .search-icon {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    font-size: 1rem;
    pointer-events: none;
}

/* --- Hero Answer Box (inline on detail pages) --- */
.hero-box {
    background: var(--slate-900);
    border-radius: var(--radius);
    padding: 2rem;
    color: #fff;
    text-align: center;
}

.hero-box .hero-label {
    font-size: 0.82rem;
    color: #94a3b8;
    margin-bottom: 0.15rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.hero-box .hero-big {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin: 0;
    line-height: 1.1;
}

.hero-box .hero-sub {
    color: #94a3b8;
    font-size: 0.95rem;
    margin: 0.35rem 0 0;
}

.hero-box .hero-sub strong {
    color: #e2e8f0;
    font-weight: 600;
}

.hero-box .hero-main {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: #cbd5e1;
}

.hero-box .hero-main strong {
    font-size: 1.35rem;
    font-weight: 800;
    color: #fff;
}

/* --- RAG Indicators --- */
.rag-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    vertical-align: middle;
    flex-shrink: 0;
}

.rag-green { background-color: #10b981; }
.rag-amber { background-color: #f59e0b; }
.rag-red   { background-color: #ef4444; }

.badge-rag-green { background-color: #10b981; color: #fff; }
.badge-rag-amber { background-color: #f59e0b; color: #fff; }
.badge-rag-red   { background-color: #ef4444; color: #fff; }

/* --- Section Headers --- */
.section-header {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gray-500);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--gray-200);
}

/* --- Cards (shared base) --- */
.card-base {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
}

/* --- Region Cards (Homepage) --- */
.region-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: 1.25rem 1.5rem;
    transition: box-shadow 0.15s, border-color 0.15s;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.region-card:hover {
    box-shadow: var(--card-shadow-hover);
    border-color: var(--gray-300);
}

.region-card h3 {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0;
    color: var(--gray-900);
}

.region-card .card-count {
    color: var(--gray-500);
    font-size: 0.8rem;
    font-weight: 500;
}

.region-card .card-meta {
    flex: 1;
}

.region-card .card-arrow {
    color: var(--gray-300);
    font-size: 1rem;
    transition: color 0.15s, transform 0.15s;
    flex-shrink: 0;
}

.region-card:hover .card-arrow {
    color: var(--gray-500);
    transform: translateX(2px);
}

/* --- Region Page --- */
.region-header h1 {
    font-size: 1.85rem;
    margin-bottom: 0.25rem;
}

.region-subtitle {
    color: var(--gray-500);
    font-size: 0.92rem;
    margin: 0;
}

.region-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.region-stat {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: 1rem 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.region-stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    background: var(--blue-50);
    color: var(--blue-700);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.region-stat-icon.green { background: var(--green-100); color: var(--green-600); }
.region-stat-icon.amber { background: var(--amber-100); color: var(--amber-600); }
.region-stat-icon.red { background: var(--red-100); color: var(--red-600); }

.region-stat-value {
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1.2;
    color: var(--gray-900);
}

.region-stat-value small {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.region-stat-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

/* Map */
.region-map-wrap {
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--gray-200);
    box-shadow: var(--card-shadow);
}

#regionMap,
#deptMap {
    height: 380px;
    width: 100%;
    background: var(--gray-100);
}

.map-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.map-marker-custom { background: none !important; border: none !important; }

.map-popup {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    line-height: 1.5;
}

.map-popup a {
    color: var(--blue-700);
    font-weight: 600;
}

/* Hospital list header */
.region-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.region-list-header h2 {
    margin: 0;
    font-size: 1.15rem;
}

.region-search-wrap {
    position: relative;
    width: 260px;
}

.region-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 0.8rem;
    pointer-events: none;
    z-index: 1;
}

.region-search-input {
    width: 100%;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.75rem 0.45rem 2.25rem;
    font-size: 0.85rem;
    background: #fff;
    color: var(--gray-900);
    transition: border-color 0.15s;
}

.region-search-input:focus {
    outline: none;
    border-color: var(--blue-700);
    box-shadow: 0 0 0 3px rgba(0,21,124,0.08);
}

/* Hospital Cards */
.hospital-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: 1rem 1.15rem;
    transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
    cursor: pointer;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.hospital-card:hover {
    box-shadow: var(--card-shadow-hover);
    border-color: var(--blue-700);
    transform: translateY(-1px);
}

.hospital-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.hospital-card-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-900);
    line-height: 1.35;
}

.hospital-card-town {
    font-size: 0.78rem;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
}

.hospital-card-town i {
    font-size: 0.7rem;
    margin-right: 0.15rem;
}

.hospital-card-bottom {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--gray-100);
}

.hospital-card-wait {
    font-size: 0.82rem;
}

.hospital-wait-num {
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--blue-700);
}

.hospital-wait-unit {
    color: var(--gray-500);
    font-size: 0.75rem;
}

.hospital-card-pct {
    font-size: 0.75rem;
    color: var(--gray-600);
    white-space: nowrap;
}

/* --- Department Cards --- */
.dept-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    transition: box-shadow 0.15s, border-color 0.15s;
    height: 100%;
}

.dept-card:hover {
    box-shadow: var(--card-shadow-hover);
    border-color: var(--gray-300);
}

.dept-card .dept-wait {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--blue-700);
    margin: 0.35rem 0;
    letter-spacing: -0.02em;
}

.dept-card-green {
    border-left: 3px solid #10b981 !important;
}

.dept-card-green .dept-wait {
    color: var(--green-600) !important;
}

.dept-card-red {
    border-left: 3px solid #ef4444 !important;
}

.dept-card-red .dept-wait {
    color: var(--red-600) !important;
}

/* --- Stat Cards (WaitTime page) — horizontal layout --- */
.stat-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: 1.15rem 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.stat-card .stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.stat-card .stat-icon.purple {
    background: var(--blue-100);
    color: var(--blue-700);
}

.stat-card .stat-icon.green {
    background: var(--green-100);
    color: var(--green-600);
}

.stat-card .stat-icon.amber {
    background: var(--amber-100);
    color: var(--amber-600);
}

.stat-card .stat-icon.red {
    background: var(--red-100);
    color: var(--red-600);
}

.stat-card .stat-icon.blue {
    background: var(--blue-100);
    color: var(--blue-700);
}

.stat-card .stat-body {
    flex: 1;
    min-width: 0;
}

.stat-card .stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.2;
    margin-bottom: 0.1rem;
}

.stat-card .stat-label {
    color: var(--gray-500);
    font-size: 0.82rem;
    line-height: 1.35;
}

/* Legacy stat-plain compatibility */
.stat-plain {
    background: #fff;
    font-size: 1.05rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--card-shadow);
}

/* --- Comparison Box --- */
.comparison-box {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius);
    padding: 1.25rem;
}

.comparison-box h2 {
    color: #92400e;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.comparison-box p {
    color: #78350f;
    font-size: 0.95rem;
    line-height: 1.6;
}

.comparison-box strong {
    color: #92400e;
}

/* --- Ranking Box --- */
.ranking-box {
    background: var(--blue-50);
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
}

.ranking-box h2 {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--blue-800);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ranking-line {
    font-size: 0.95rem;
    color: var(--slate-800);
    margin-bottom: 0.35rem;
    line-height: 1.5;
}

.ranking-line i {
    color: var(--blue-700);
    margin-right: 0.15rem;
}

/* --- Link Cards --- */
.link-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: 1.25rem;
    transition: box-shadow 0.15s, border-color 0.15s;
    height: 100%;
}

.link-card:hover {
    box-shadow: var(--card-shadow-hover);
    border-color: var(--gray-300);
}

.link-card h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--gray-900);
}

/* --- Buttons --- */
.btn-outline-modern {
    border: 1.5px solid var(--blue-700);
    color: var(--blue-700);
    font-weight: 600;
    padding: 0.45rem 1rem;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
    background: transparent;
    font-size: 0.85rem;
}

.btn-outline-modern:hover {
    background: var(--blue-700);
    color: #fff;
}

.btn-primary-gradient {
    background: var(--blue-700);
    border: none;
    color: #fff;
    font-weight: 600;
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
    font-size: 0.85rem;
}

.btn-primary-gradient:hover {
    background: var(--blue-800);
    color: #fff;
}

/* --- Search Box --- */
#hospitalSearch {
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    padding: 0.65rem 1rem;
    transition: border-color 0.15s;
    background: #fff;
    box-shadow: var(--card-shadow);
}

#hospitalSearch:focus {
    border-color: var(--blue-700);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.08);
    outline: none;
}

#hospitalSearch::placeholder {
    color: var(--gray-400);
}

/* --- Modern Table --- */
.modern-table-wrap {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

.modern-table-wrap .dataTables_wrapper {
    padding: 0;
}

.modern-table-wrap .dataTables_wrapper > .row {
    margin: 0;
}

/* Top and bottom control bars only */
.modern-table-wrap .dataTables_wrapper > .row:first-child,
.modern-table-wrap .dataTables_wrapper > .row:last-child {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modern-table-wrap .dataTables_wrapper > .row:first-child > div,
.modern-table-wrap .dataTables_wrapper > .row:last-child > div {
    flex: 0 0 auto;
    width: auto;
    padding: 0;
}

/* Middle row containing the table – must stay full width */
.modern-table-wrap .dataTables_wrapper > .row:nth-child(2) {
    padding: 0;
}

.modern-table-wrap .dataTables_wrapper > .row:nth-child(2) > div {
    width: 100%;
    padding: 0;
}

.modern-table-wrap .dataTables_length label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    color: var(--gray-500);
    font-size: 0.82rem;
    white-space: nowrap;
    margin: 0;
}

.modern-table-wrap .dataTables_length select {
    display: inline-block;
    width: auto;
    min-width: 4rem;
}

.modern-table-wrap .dataTables_filter label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
}

.modern-table-wrap .dataTables_info,
.modern-table-wrap .dataTables_paginate {
    flex: 0 0 auto;
    width: auto;
    padding: 0;
}

.dataTables_filter input {
    border: 1.5px solid var(--gray-300) !important;
    border-radius: var(--radius-sm) !important;
    padding: 0.4rem 0.75rem !important;
    transition: border-color 0.15s;
    font-size: 0.85rem;
}

.dataTables_filter input:focus {
    border-color: var(--blue-700) !important;
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.08);
    outline: none;
}

.dataTables_filter label {
    font-weight: 600;
    color: var(--gray-500);
    font-size: 0.82rem;
}

.dataTables_length select {
    border: 1.5px solid var(--gray-300);
    border-radius: 0.375rem;
    padding: 0.25rem 0.4rem;
}

/* DataTables pagination – Bootstrap 5 (.page-item) and fallback (.paginate_button) */
.dataTables_paginate .pagination {
    margin: 0;
    gap: 3px;
    flex-wrap: wrap;
}

.dataTables_paginate .page-item .page-link {
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.82rem;
    padding: 0.4rem 0.75rem;
    color: var(--gray-600);
    background: var(--gray-50);
    line-height: 1.4;
}

.dataTables_paginate .page-item.active .page-link {
    background: var(--blue-700);
    color: #fff;
    box-shadow: 0 1px 3px rgba(0, 21, 124, 0.25);
}

.dataTables_paginate .page-item .page-link:hover {
    background: var(--blue-50);
    color: var(--blue-700);
}

.dataTables_paginate .page-item.active .page-link:hover {
    background: var(--blue-800);
    color: #fff;
}

.dataTables_paginate .page-item.disabled .page-link {
    color: var(--gray-300);
    background: transparent;
    pointer-events: none;
}

/* Fallback for non-Bootstrap DataTables rendering */
.dataTables_paginate .paginate_button {
    border: none !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
    font-size: 0.82rem !important;
    padding: 0.4rem 0.75rem !important;
    color: var(--gray-600) !important;
    background: var(--gray-50) !important;
    margin: 0 1px !important;
    cursor: pointer;
}

.dataTables_paginate .paginate_button.current {
    background: var(--blue-700) !important;
    color: #fff !important;
    box-shadow: 0 1px 3px rgba(0, 21, 124, 0.25);
}

.dataTables_paginate .paginate_button:hover {
    background: var(--blue-50) !important;
    color: var(--blue-700) !important;
}

.dataTables_paginate .paginate_button.current:hover {
    background: var(--blue-800) !important;
    color: #fff !important;
}

.dataTables_paginate .paginate_button.disabled,
.dataTables_paginate .paginate_button.disabled:hover {
    color: var(--gray-300) !important;
    background: transparent !important;
    cursor: default;
}

.dataTables_info {
    font-size: 0.82rem;
    color: var(--gray-400);
    font-weight: 500;
}

.modern-table {
    margin-bottom: 0 !important;
    border-collapse: separate;
    border-spacing: 0;
    width: 100% !important;
}

.modern-table thead th {
    font-weight: 600 !important;
    font-size: 0.75rem !important;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-500) !important;
    background: var(--gray-50) !important;
    border-bottom: 1px solid var(--gray-200) !important;
    border-top: none !important;
    padding: 0.85rem 1.25rem !important;
    white-space: nowrap;
}

.modern-table tbody td {
    vertical-align: middle;
    padding: 0.9rem 1.25rem !important;
    border-bottom: 1px solid var(--gray-100) !important;
    border-top: none !important;
    font-size: 0.9rem;
}

.modern-table tbody tr:last-child td { border-bottom: none !important; }

.modern-table tbody tr:hover td { background-color: var(--gray-50) !important; }

.modern-table thead th:first-child,
.modern-table tbody td:first-child {
    width: 40%;
}

.region-pill-mobile {
    display: none;
    font-size: 0.7rem;
    color: var(--gray-500);
    margin-top: 2px;
}

.modern-table tbody td a {
    color: var(--blue-700);
    font-weight: 600;
    text-decoration: none;
}

.modern-table tbody td a:hover {
    color: var(--blue-800);
    text-decoration: underline;
}

/* Table cell components */
.region-pill {
    display: inline-block;
    background: var(--gray-100);
    color: var(--gray-500);
    padding: 0.15rem 0.55rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.wait-value {
    font-weight: 700;
    font-size: 1rem;
    color: var(--gray-900);
}

.wait-unit {
    color: var(--gray-400);
    font-size: 0.78rem;
    font-weight: 500;
    margin-left: 0.1rem;
}

.pct-bar-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 120px;
}

.pct-bar {
    height: 6px;
    border-radius: 3px;
    flex: 1;
    max-width: 70px;
}

.pct-bar.rag-green { background: #10b981; }
.pct-bar.rag-amber { background: #f59e0b; }
.pct-bar.rag-red   { background: #ef4444; }

.pct-text {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--gray-700);
    white-space: nowrap;
}

.long-waiter {
    display: inline-block;
    background: #fef2f2;
    color: var(--red-600);
    padding: 0.1rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.82rem;
    font-weight: 600;
}

/* --- Breadcrumb --- */
.breadcrumb {
    margin-bottom: 1rem;
    font-size: 0.82rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    scrollbar-width: none;
}
.breadcrumb::-webkit-scrollbar { display: none; }

.breadcrumb-item a {
    color: var(--blue-700);
    text-decoration: none;
    font-weight: 500;
}

.breadcrumb-item a:hover {
    color: var(--blue-800);
    text-decoration: underline;
}

.breadcrumb-item.active { color: var(--gray-500); }

/* --- Footer --- */
.site-footer {
    background: var(--slate-900);
    color: #64748b;
    padding: 2.5rem 0;
    margin-top: 4rem;
    border-top: 1px solid rgba(255,255,255,0.04);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 2rem;
}

.footer-brand {
    margin-bottom: 0.75rem;
}

.footer-logo {
    height: 30px;
    width: auto;
}

.footer-desc {
    font-size: 0.82rem;
    line-height: 1.6;
    color: #475569;
    margin-bottom: 0;
}

.footer-heading {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    margin-bottom: 0.75rem;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li { margin-bottom: 0.35rem; }

.footer-links a {
    color: #64748b;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 500;
    transition: color 0.15s;
}

.footer-links a:hover { color: #e2e8f0; }

.footer-ogl {
    margin-top: 1.5rem;
    padding: 0.75rem 1rem;
    background: rgba(255,255,255,0.04);
    border-radius: 6px;
    font-size: 0.76rem;
    color: #64748b;
    line-height: 1.5;
}
.footer-ogl a {
    color: #94a3b8;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.footer-ogl a:hover { color: #e2e8f0; }

.footer-bottom {
    margin-top: 1rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.06);
    font-size: 0.75rem;
    color: #475569;
}

.footer-legal-links {
    display: block;
    margin-top: 0.5rem;
}

.footer-legal-links a {
    color: #64748b;
    text-decoration: none;
    font-weight: 500;
    margin-right: 1.25rem;
    transition: color 0.15s;
}

.footer-legal-links a:hover {
    color: #e2e8f0;
}

/* --- Content / Legal Pages --- */
.content-page { max-width: 800px; }
.content-page h1 { margin-bottom: 0.5rem; }
.content-page .page-subtitle { color: var(--gray-500); font-size: 0.88rem; margin-bottom: 2rem; }
.content-page h2 { font-size: 1.1rem; margin-top: 2rem; margin-bottom: 0.5rem; color: var(--gray-900); }
.content-page h3 { font-size: 0.95rem; margin-top: 1.5rem; margin-bottom: 0.4rem; }
.content-page p, .content-page li { font-size: 0.92rem; line-height: 1.75; color: var(--gray-600); }
.content-page ul { padding-left: 1.25rem; margin-bottom: 1rem; }
.content-page li { margin-bottom: 0.3rem; }
.content-page strong { color: var(--gray-900); }
.content-page a { color: var(--blue-700); }
.content-page a:hover { color: var(--blue-800); }

.how-step {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
    padding: 1.25rem;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    margin-bottom: 0.75rem;
}

.how-step-num {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--blue-700);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    flex-shrink: 0;
}

.how-step-body h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
    color: var(--gray-900);
}

.how-step-body p {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--gray-600);
}

/* --- Trust Bar (Homepage) --- */
.trust-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin: 2.5rem 0 1.5rem;
    padding: 1.5rem;
    background: var(--blue-50);
    border: 1px solid var(--blue-100);
    border-radius: var(--radius-lg);
}
.trust-signal {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}
.trust-signal > i {
    font-size: 1.5rem;
    color: var(--blue-700);
    flex-shrink: 0;
    margin-top: 2px;
}
.trust-signal strong {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.3;
}
.trust-signal span {
    font-size: 0.78rem;
    color: var(--gray-500);
    line-height: 1.4;
}

.homepage-about-cta {
    text-align: center;
    max-width: 680px;
    margin: 0 auto 2rem;
    padding: 1.5rem;
}
.homepage-about-cta p {
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
}
.homepage-about-cta a {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--blue-700);
    text-decoration: none;
}
.homepage-about-cta a:hover {
    text-decoration: underline;
}

/* --- Contact Page --- */
.contact-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 2.5rem;
    margin-top: 1.5rem;
}
.contact-form-wrap h2 {
    font-size: 1.1rem;
    margin-bottom: 1.25rem;
}
.contact-form .form-group {
    margin-bottom: 1rem;
}
.contact-form label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.3rem;
}
.contact-form .form-control {
    font-size: 0.88rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    transition: border-color 0.15s;
}
.contact-form .form-control:focus {
    border-color: var(--blue-500);
    box-shadow: 0 0 0 3px rgba(0,21,124,0.08);
    outline: none;
}
.contact-form textarea.form-control {
    resize: vertical;
    min-height: 120px;
}
.btn-contact-submit {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.5rem;
    background: var(--blue-700);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-contact-submit:hover {
    background: var(--blue-800);
}
.contact-info-wrap {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.contact-info-card {
    padding: 1.25rem;
    background: var(--blue-50);
    border: 1px solid var(--blue-100);
    border-radius: var(--radius);
}
.contact-info-card h3 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 0.5rem;
}
.contact-info-card h3 i {
    color: var(--blue-700);
    margin-right: 0.4rem;
}
.contact-info-card p {
    font-size: 0.84rem;
    line-height: 1.6;
    color: var(--gray-600);
    margin: 0;
}
.contact-info-card a {
    color: var(--blue-700);
    font-weight: 600;
    text-decoration: none;
    font-size: 0.88rem;
}
.contact-info-card a:hover {
    text-decoration: underline;
}

/* --- About / E-E-A-T Page --- */
.eeat-section {
    margin-bottom: 2.5rem;
}
.eeat-section h2 {
    font-size: 1.15rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    color: var(--gray-900);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--blue-100);
}
.eeat-list {
    list-style: none;
    padding-left: 0;
}
.eeat-list li {
    padding: 0.4rem 0;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}
.eeat-list li i {
    color: var(--blue-700);
    font-size: 1rem;
    margin-top: 2px;
    flex-shrink: 0;
}
.eeat-standards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    margin-top: 1rem;
}
.eeat-standard {
    padding: 1.25rem;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
}
.eeat-standard-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--blue-50);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
}
.eeat-standard-icon i {
    font-size: 1.15rem;
    color: var(--blue-700);
}
.eeat-standard h3 {
    font-size: 0.92rem;
    font-weight: 700;
    margin: 0 0 0.35rem;
    color: var(--gray-900);
}
.eeat-standard p {
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--gray-600);
    margin: 0;
}
.eeat-methodology {
    padding-left: 1.25rem;
    counter-reset: none;
}
.eeat-methodology li {
    margin-bottom: 0.75rem;
    padding-left: 0.25rem;
}
.eeat-cta {
    text-align: center;
    padding: 2rem;
    background: var(--blue-50);
    border: 1px solid var(--blue-100);
    border-radius: var(--radius-lg);
}
.eeat-cta h2 {
    border-bottom: none;
    text-align: center;
}
.btn-eeat-contact {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.5rem;
    background: var(--blue-700);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s;
}
.btn-eeat-contact:hover {
    background: var(--blue-800);
    color: #fff;
}

/* --- FAQ Section --- */
.faq-section h2 {
    font-size: 1.15rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--gray-900);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--blue-100);
}
.faq-item {
    padding: 1.25rem;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    box-shadow: var(--card-shadow);
}
.faq-item h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 0.5rem;
}
.faq-item p {
    font-size: 0.86rem;
    line-height: 1.7;
    color: var(--gray-600);
    margin: 0;
}

/* Data source attribution line */
.data-source-line {
    margin-top: 2rem;
    padding: 0.75rem 1rem;
    background: var(--blue-50);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius);
    font-size: 0.82rem;
    color: var(--gray-600);
}
.data-source-line i { margin-right: 0.35rem; color: var(--primary); }
.data-source-line a { color: var(--primary); text-decoration: underline; }

/* Inline disclaimer */
.inline-disclaimer {
    margin-top: 1rem;
    padding: 0.6rem 0.85rem;
    background: var(--gray-50);
    border-radius: var(--radius);
    font-size: 0.78rem;
    color: var(--gray-500);
    line-height: 1.5;
}
.inline-disclaimer a { color: var(--gray-600); text-decoration: underline; }

/* Last reviewed date */
.last-reviewed {
    margin-top: 2.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
    font-size: 0.78rem;
    color: var(--gray-400);
    font-style: italic;
}

/* --- Misc --- */
.text-gradient { color: var(--blue-700); }

.badge-modern {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 0.3rem;
    font-size: 0.72rem;
    font-weight: 600;
}

.badge-nhs {
    background: var(--blue-100);
    color: var(--blue-800);
}

.badge-region {
    background: var(--gray-100);
    color: var(--gray-700);
}

.badge-updated {
    background: var(--green-100);
    color: var(--green-600);
}
a.badge-updated:hover {
    background: var(--green-200, #bbf7d0);
    color: var(--green-700, #15803d);
}

.badge-independent {
    background: var(--amber-100);
    color: #92400e;
}

.updated-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 0.3rem;
    font-size: 0.78rem;
    font-weight: 600;
}

/* Rank numbers */
.rank-number {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.rank-green { background: var(--green-100); color: var(--green-600); }
.rank-red   { background: var(--red-100);   color: var(--red-600); }

/* --- Specialty ranking list --- */
.spec-rank-list {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.spec-rank-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.12s;
}

.spec-rank-item:last-child { border-bottom: none; }

.spec-rank-item:hover { background: var(--gray-50); }

.spec-rank-info {
    flex: 1;
    min-width: 0;
}

.spec-rank-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.spec-rank-region {
    font-size: 0.72rem;
    color: var(--gray-500);
}

.spec-rank-wait {
    font-weight: 800;
    font-size: 1rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.spec-rank-wait small {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.green-text { color: var(--green-600); }
.red-text { color: var(--red-600); }

/* --- Dept browse (Homepage) --- */
.dept-browse {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    box-shadow: var(--card-shadow);
    padding: 0.65rem 0.85rem;
    transition: box-shadow 0.15s, border-color 0.15s;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.dept-browse:hover {
    box-shadow: var(--card-shadow-hover);
    border-color: var(--gray-300);
}

.dept-browse .dept-icon {
    width: 32px;
    height: 32px;
    border-radius: 0.375rem;
    background: var(--blue-50);
    color: var(--blue-700);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.dept-browse .dept-name {
    font-weight: 600;
    color: var(--gray-900);
    font-size: 0.85rem;
}

/* --- Content Boxes (shared pattern) --- */
.content-box {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: 1.25rem;
}

.content-box h2 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.75rem;
}

/* --- Conditions Box --- */
.conditions-box {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: 1.25rem;
}

.conditions-box h2 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.35rem;
}

.conditions-intro {
    color: var(--gray-500);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.conditions-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.condition-tag {
    display: inline-block;
    background: var(--gray-100);
    color: var(--gray-700);
    padding: 0.3rem 0.7rem;
    border-radius: 0.3rem;
    font-size: 0.78rem;
    font-weight: 500;
}

/* --- Hospital Info Card --- */
.info-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: 1.25rem;
}

.info-card h2 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.85rem;
}

.info-grid {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.info-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.info-icon {
    font-size: 0.9rem;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
    color: var(--gray-400);
}

.info-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.info-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-400);
    margin-bottom: 0;
}

.info-value {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--gray-900);
    word-break: break-word;
}

.info-value a {
    color: var(--blue-700);
    text-decoration: none;
    font-weight: 500;
}

.info-value a:hover {
    color: var(--blue-800);
    text-decoration: underline;
}

/* --- Predecessors Box --- */
.predecessors-box {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: 1.25rem;
}

.predecessors-box h2 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.35rem;
}

.predecessors-intro {
    color: var(--gray-500);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.predecessors-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.predecessor-tag {
    display: inline-block;
    background: var(--gray-50);
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
    padding: 0.3rem 0.7rem;
    border-radius: 0.3rem;
    font-size: 0.78rem;
    font-weight: 500;
}

/* --- Summary paragraph --- */
.summary-paragraph {
    font-size: 0.95rem;
    line-height: 1.75;
    color: var(--gray-600);
}

/* --- Chart box --- */
.chart-box {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: 1.25rem;
}

.chart-box h2 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.15rem;
}

.chart-intro {
    color: var(--gray-500);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.chart-container {
    position: relative;
    height: 280px;
    width: 100%;
}

/* --- Long waiters --- */
.long-waiters-box {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: 1.25rem;
}

.long-waiters-box h2 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.15rem;
}

.long-waiters-intro {
    color: var(--gray-500);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.long-waiters-grid {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.long-waiter-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.85rem;
    background: #fef2f2;
    border-radius: var(--radius-sm);
}

.long-waiter-count {
    font-size: 1.1rem;
    font-weight: 700;
    min-width: 55px;
}

.long-waiter-label {
    color: var(--gray-600);
    font-size: 0.85rem;
}

.amber-text { color: var(--amber-600); }
.red-text   { color: var(--red-600); }
.dark-red-text { color: #991b1b; }

/* --- Nearby hospitals --- */
.nearby-box {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: 1.25rem;
}

.nearby-box h2 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.15rem;
}

.nearby-intro {
    color: var(--gray-500);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.nearby-grid {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.nearby-card {
    display: block;
    padding: 0.75rem 0.85rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.nearby-card:hover {
    border-color: var(--gray-300);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    text-decoration: none;
    color: inherit;
}

.nearby-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.1rem;
}

.nearby-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--gray-900);
}

.nearby-town {
    font-size: 0.78rem;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
}

.nearby-stats {
    display: flex;
    gap: 0.85rem;
    font-size: 0.82rem;
}

.nearby-wait {
    font-weight: 700;
    color: var(--blue-700);
}

.nearby-pct { color: var(--gray-500); }

/* --- Two-column insight row --- */
.insight-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.insight-row > :only-child {
    grid-column: 1 / -1;
}

/* =============================================
   RESPONSIVE — Mobile-first overrides
   ============================================= */

/* ---------- Tablet (≤992px) ---------- */
@media (max-width: 992px) {
    .container { padding-left: 1.25rem; padding-right: 1.25rem; }
    .region-stats-row { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: 1fr 1fr; gap: 1.5rem; }
    .trust-bar { grid-template-columns: repeat(2, 1fr); }
    .eeat-standards-grid { grid-template-columns: 1fr; }
    .contact-grid { grid-template-columns: 1fr; }
}

/* ---------- Mobile landscape / small tablet (≤768px) ---------- */
@media (max-width: 768px) {
    /* Typography */
    h1 { font-size: 1.35rem; }
    h2 { font-size: 1.05rem; }
    .region-header h1 { font-size: 1.5rem; }

    /* Container breathing room */
    .container { padding-left: 1rem; padding-right: 1rem; }
    .container.mt-4 { margin-top: 1rem !important; }

    /* Navbar */
    .site-nav .navbar-brand { font-size: 1.05rem; }

    /* Page hero (homepage) */
    .page-hero { padding: 2.5rem 1.25rem 5.5rem; margin-top: -1rem; }
    .page-hero h1 { font-size: 1.5rem; max-width: none; }
    .page-hero p { max-width: none; font-size: 0.92rem; }
    .page-hero::after { height: 80px; }
    .page-hero .hero-search { max-width: none; margin-top: 1.25rem; }

    /* Hero box (detail pages) */
    .hero-box { padding: 1.5rem 1rem; }
    .hero-box .hero-big { font-size: 2.5rem; }
    .hero-box .hero-label { font-size: 0.75rem; }
    .hero-box .hero-main { font-size: 1rem; }

    /* Stat cards */
    .stat-card { padding: 0.9rem 1rem; gap: 0.75rem; }
    .stat-card .stat-icon { width: 38px; height: 38px; font-size: 1.05rem; }
    .stat-card .stat-value { font-size: 1.1rem; }
    .stat-card .stat-label { font-size: 0.78rem; }

    /* Region stats */
    .region-stats-row { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
    .region-stat { padding: 0.75rem 0.85rem; gap: 0.65rem; }
    .region-stat-icon { width: 36px; height: 36px; font-size: 1rem; }
    .region-stat-value { font-size: 1.05rem; }
    .region-stat-label { font-size: 0.7rem; max-width: none; white-space: normal; }

    /* Maps */
    #regionMap, #deptMap { height: 260px; }

    /* Search */
    .region-list-header { flex-direction: column; align-items: stretch; gap: 0.5rem; }
    .region-search-wrap { width: 100%; }
    .region-search-icon { left: 0.6rem; font-size: 0.72rem; }
    .region-search-input { padding-left: 1.85rem; font-size: 0.82rem; }

    /* Hospital cards — 1 column on mobile */
    .hospital-card { padding: 0.85rem 1rem; }
    .hospital-card-name { font-size: 0.88rem; }

    /* Insight row — stack */
    .insight-row { grid-template-columns: 1fr; gap: 1rem; }

    /* Spec rank lists */
    .spec-rank-list { overflow-x: hidden; }
    .spec-rank-item { padding: 0.6rem 0.85rem; gap: 0.6rem; }
    .spec-rank-name { font-size: 0.82rem; white-space: normal; overflow: visible; text-overflow: unset; }
    .spec-rank-wait { font-size: 0.9rem; }

    /* Chart */
    .chart-container { height: 220px; }

    /* DataTable */
    .modern-table-wrap { border-radius: 0.5rem; overflow-x: hidden; }
    .modern-table-wrap .dataTables_wrapper > .row:first-child,
    .modern-table-wrap .dataTables_wrapper > .row:last-child {
        padding: 0.75rem 0.85rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .modern-table { min-width: 0 !important; width: 100% !important; }
    .modern-table thead th { padding: 0.65rem 0.6rem !important; font-size: 0.63rem !important; }
    .modern-table tbody td { padding: 0.6rem 0.6rem !important; font-size: 0.8rem; }
    .modern-table thead th:first-child,
    .modern-table tbody td:first-child { width: auto; }

    /* Hide Region and 52+ Wk columns on mobile, show inline region */
    .col-region { display: none !important; }
    .col-52wk { display: none !important; }
    .region-pill-mobile { display: block; }

    /* Pagination — prev/next only on mobile, hide numbered pages */
    .dataTables_paginate .pagination { gap: 2px; flex-wrap: nowrap; }
    .dataTables_paginate .page-item { display: none; }
    .dataTables_paginate .page-item:first-child,
    .dataTables_paginate .page-item:last-child,
    .dataTables_paginate .page-item.active { display: block; }
    .dataTables_paginate .page-item .page-link {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
        min-width: 0;
    }
    /* Fallback for non-Bootstrap rendering */
    .dataTables_paginate .paginate_button { display: none !important; }
    .dataTables_paginate .paginate_button.previous,
    .dataTables_paginate .paginate_button.next,
    .dataTables_paginate .paginate_button.current { display: inline-block !important; }
    .dataTables_paginate .paginate_button {
        padding: 0.4rem 0.75rem !important;
        font-size: 0.8rem !important;
        min-width: 0 !important;
    }
    .dataTables_info { font-size: 0.72rem; }
    .dataTables_length label, .dataTables_filter label { font-size: 0.75rem; }
    .dataTables_filter input { font-size: 0.8rem; padding: 0.35rem 0.6rem !important; }

    /* Nearby cards */
    .nearby-card { padding: 0.75rem 0.85rem; }

    /* Comparison / ranking boxes */
    .comparison-box, .ranking-box { padding: 1rem; }
    .comparison-box p, .ranking-line { font-size: 0.88rem; }

    /* Info card */
    .info-card { padding: 1rem; }

    /* Conditions */
    .conditions-box { padding: 1rem; }
    .condition-tag { font-size: 0.75rem; padding: 0.25rem 0.6rem; }

    /* Dept cards */
    .dept-card .dept-wait { font-size: 1.3rem; }

    /* Footer */
    .footer-grid { grid-template-columns: 1fr; gap: 1.25rem; }
    .site-footer { padding: 1.75rem 0; margin-top: 2.5rem; }
    .footer-desc { font-size: 0.78rem; }

    /* Breadcrumbs */
    .breadcrumb { font-size: 0.78rem; }
    .breadcrumb-item + .breadcrumb-item::before { padding: 0 0.3rem; }

    /* Summary paragraph */
    .summary-paragraph { font-size: 0.88rem; line-height: 1.65; }
}

/* ---------- Small phone (≤480px) ---------- */
@media (max-width: 480px) {
    .trust-bar { grid-template-columns: 1fr; gap: 0.75rem; padding: 1rem; }
    .trust-signal > i { font-size: 1.25rem; }
    .eeat-standards-grid { gap: 0.75rem; }
    .eeat-standard { padding: 1rem; }

    /* Typography */
    h1 { font-size: 1.2rem; }
    .region-header h1 { font-size: 1.3rem; }

    /* Container */
    .container { padding-left: 0.75rem; padding-right: 0.75rem; }

    /* Hero */
    .page-hero { padding: 2rem 1rem 4.5rem; }
    .page-hero h1 { font-size: 1.3rem; }
    .page-hero::after { height: 55px; }
    .page-hero .hero-search input { padding: 0.6rem 0.85rem 0.6rem 2.5rem; font-size: 0.88rem; }
    .hero-box .hero-big { font-size: 2.2rem; }
    .hero-box .hero-sub { font-size: 0.85rem; }
    .hero-box .hero-label { font-size: 0.7rem; letter-spacing: 0.03em; }

    /* Stat cards — stack icon and body */
    .stat-card { flex-direction: row; padding: 0.85rem; gap: 0.65rem; }
    .stat-card .stat-icon { width: 34px; height: 34px; font-size: 0.95rem; border-radius: 0.5rem; }
    .stat-card .stat-value { font-size: 1rem; }
    .stat-card .stat-label { font-size: 0.75rem; }

    /* Region stats — single column */
    .region-stats-row { grid-template-columns: 1fr 1fr; gap: 0.4rem; }
    .region-stat { padding: 0.65rem 0.7rem; gap: 0.5rem; }
    .region-stat-icon { width: 30px; height: 30px; font-size: 0.88rem; }
    .region-stat-value { font-size: 0.95rem; }
    .region-stat-value small { font-size: 0.6rem; }

    /* Maps */
    #regionMap, #deptMap { height: 200px; }

    /* DataTable — fit within screen, no horizontal scroll */
    .modern-table-wrap { overflow-x: hidden; }
    .modern-table { min-width: 0 !important; }
    .modern-table thead th { padding: 0.5rem 0.4rem !important; font-size: 0.6rem !important; letter-spacing: 0; }
    .modern-table tbody td { padding: 0.55rem 0.4rem !important; font-size: 0.76rem; }
    .modern-table tbody td a { font-size: 0.76rem; }
    .pct-bar-wrap { min-width: 0; }
    .pct-text { font-size: 0.7rem; }
    .wait-value { font-size: 0.85rem; }
    .wait-unit { font-size: 0.6rem; }

    /* Pagination — inherits prev/next only from 768px */
    .dataTables_info { font-size: 0.68rem; }

    /* Hide length selector on small phones to save space */
    .dataTables_length { display: none !important; }
    .modern-table-wrap .dataTables_wrapper > .row:first-child { justify-content: flex-end; }
    .modern-table-wrap .dataTables_wrapper > .row:last-child { flex-direction: column; gap: 0.5rem; align-items: center; }

    /* Hospital card bottom */
    .hospital-card-bottom { flex-direction: column; align-items: flex-start; gap: 0.25rem; }

    /* Dept browse cards */
    .dept-browse { padding: 0.55rem 0.75rem; }
    .dept-browse .dept-icon { width: 28px; height: 28px; font-size: 0.78rem; }
    .dept-browse .dept-name { font-size: 0.8rem; }

    /* Region card */
    .region-card { padding: 1rem 1.1rem; gap: 0.75rem; }
    .region-card h3 { font-size: 0.92rem; }

    /* Chart */
    .chart-container { height: 190px; }
    .chart-box { padding: 1rem; }
    .chart-intro { font-size: 0.78rem; }

    /* Long waiters */
    .long-waiters-box { padding: 1rem; }
    .long-waiter-row { font-size: 0.82rem; }

    /* Nearby */
    .nearby-card { padding: 0.65rem 0.75rem; }
    .nearby-stats { font-size: 0.78rem; }

    /* Ranking */
    .ranking-line { font-size: 0.85rem; }

    /* Footer */
    .footer-bottom { font-size: 0.7rem; }

    /* Breadcrumbs */
    .breadcrumb { font-size: 0.72rem; margin-bottom: 0.5rem !important; }

    /* Touch: bigger tap targets for links in lists */
    .spec-rank-item { padding: 0.75rem 0.85rem; min-height: 48px; }
    .spec-rank-name { font-size: 0.8rem; white-space: normal; overflow: visible; text-overflow: unset; }
    .spec-rank-wait { font-size: 0.85rem; }
    .spec-rank-list { max-width: 100%; overflow-x: hidden; }
    .nearby-card { min-height: 48px; }
}

/* ---------- Tiny phone (≤360px) ---------- */
@media (max-width: 360px) {
    .container { padding-left: 0.6rem; padding-right: 0.6rem; }
    .page-hero { padding: 1.75rem 0.75rem 4rem; }
    .page-hero h1 { font-size: 1.15rem; }
    .hero-box .hero-big { font-size: 1.9rem; }
    .hero-box { padding: 1.25rem 0.75rem; }
    .region-stats-row { grid-template-columns: 1fr; }
    #regionMap, #deptMap { height: 180px; }
    .stat-card .stat-value { font-size: 0.95rem; }
    .modern-table { min-width: 0 !important; }
    .modern-table thead th { padding: 0.4rem 0.3rem !important; font-size: 0.56rem !important; }
    .modern-table tbody td { padding: 0.45rem 0.3rem !important; font-size: 0.72rem; }
}
