/* Shared layout constraints: shrink grid items, keep deliberate table scrolling local. */
.booking-grid, .reading-grid, .split, .footer-grid, .next-hero-grid,
.doctor-about-grid, .dashboard-grid, .editor-grid, .stats, .article-grid,
.service-grid, .media-grid, .contact-summary > .container {
    min-width: 0;
}
.booking-grid > *, .reading-grid > *, .split > *, .footer-grid > *,
.next-hero-grid > *, .doctor-about-grid > *, .dashboard-grid > *,
.editor-grid > *, .stats > *, .article-grid > *, .media-grid > *,
.form-grid > *, .contact-summary > .container > * {
    min-width: 0;
}
form, fieldset, article, .card, .sticky-card, .admin-main, .admin-shell {
    min-width: 0;
}
fieldset { max-width: 100%; }
.button, button { min-width: 0; white-space: normal; text-align: center; }
input, textarea, select { max-width: 100%; min-width: 0; }
input[type=checkbox], input[type=radio] {
    min-height: 0;
    flex-shrink: 0;
}
.check input { width: 20px; height: 20px; flex: 0 0 20px; }
.check > span { min-width: 0; }

/* Offscreen anti-spam fields were adding 10,000px to RTL document width. */
.honey {
    position: absolute;
    left: 0;
    top: 0;
    width: 1px;
    height: 1px;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    padding: 0;
    margin: 0;
    border: 0;
    pointer-events: none;
}
.honey input {
    width: 1px;
    height: 1px;
    min-height: 0;
    padding: 0;
    border: 0;
    margin: 0;
}
.prose, .footer-address, .contact-grid p, .notice, .tracking,
.search-preview, .social-preview, .account-heading, .admin-main td {
    overflow-wrap: anywhere;
}
.prose img, .prose video, .prose iframe { max-width: 100%; height: auto; }
.prose table, .prose pre {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
}
.table-wrap {
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
}
.table-scroll-hint { margin: 0 0 12px; font-size: 11px; color: #537b91; }
.slot-option input, .schedule-choice input {
    width: 1px;
    height: 1px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
}
.contact-grid .text-link { display: flex; margin: 10px 0 18px; }
.contact-grid .button { max-width: 100%; }
.footer-social { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.footer-social a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 12px; border: 1px solid #cce6f4; border-radius: 11px; color: #087cc4; font-size: 12px; }
.footer-social a, .social-field-label { gap: 7px; }
.social-field-label { display: inline-flex; align-items: center; }
.social-icon { flex: 0 0 auto; }
.article-question { margin-block-start: 26px; scroll-margin-block-start: 20px; }
.article-question textarea, .article-answer-form textarea { width: 100%; resize: vertical; }
.article-question .text-link { margin-inline-start: 12px; }
.article-message { overflow-wrap: anywhere; }
.article-answer-form { margin-block-start: 18px; }
#my-questions { scroll-margin-block-start: 20px; }

@media (max-width: 1024px) {
    .site-header .nav { height: 76px; gap: 16px; }
    .site-header .menu-toggle { display: grid; place-items: center; margin-inline-start: auto; flex-shrink: 0; width: 44px; height: 44px; padding: 0; font-size: 0; }
    .site-header .menu-toggle:after { content: '☰'; font-size: 21px; line-height: 1; }
    .site-header .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        inset-inline: 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        margin: 0;
        padding: 8px 18px;
        max-height: calc(100dvh - 170px);
        overflow-y: auto;
        background: #fff;
        border: 1px solid #dcebf4;
        border-radius: 16px;
        box-shadow: 0 16px 35px #075e8c18;
        z-index: 120;
    }
    .site-header .nav-links.open { display: flex; }
    .site-header .nav-links a { padding: 13px 4px; min-height: 46px; font-size: 14px; }
    .site-header .nav-links a.selected:after { bottom: 8px; }
    .site-header .nav-book { margin-inline-start: 0; white-space: nowrap; }
    .next-hero-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .next-hero-copy { padding: 42px 0 0; }
    .next-hero-copy h1 { font-size: clamp(36px, 6vw, 54px); }
    .care-visual { max-width: 100%; margin: 10px auto 40px; }
    .care-intro { gap: 24px; }
    .contact-summary > .container { grid-template-columns: minmax(0, 1fr); gap: 24px; }
    .contact-summary-items { gap: 24px; }
    .contact-summary .button { justify-self: start; }
    .contact-summary-items .contact-address { flex: 1; }
    .contact-summary-items .contact-address b { font-size: 12px; }
    .booking-grid, .reading-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
    .booking-grid aside .sticky-card, .reading-grid aside .sticky-card { position: static; }
    .sidebar { position: static; width: 100%; padding: 18px 24px; overflow: hidden; border-bottom: 1px solid #dcebf4; }
    .sidebar .brand { margin: 0 0 14px; }
    .sidebar .nav-caption, .sidebar-bottom .badge { display: none; }
    .sidebar nav { display: flex; max-width: 100%; overflow-x: auto; gap: 7px; padding: 4px 2px 12px; overscroll-behavior-x: contain; }
    .sidebar nav a { flex: 0 0 auto; min-height: 44px; white-space: nowrap; padding: 10px 13px; }
    .sidebar-bottom { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 8px; padding: 0; }
    .sidebar-bottom button { min-height: 40px; }
    .admin-shell { margin: 0; }
    .admin-main { padding: 24px; }
    .admin-header { padding: 16px 24px; height: auto; min-height: 76px; gap: 18px; }
    .editor-grid, .dashboard-grid, .admin-split { grid-template-columns: minmax(0, 1fr); }
    .admin-main .filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: end; }
    .admin-main .filters label { min-width: 0; margin: 0; }
    .admin-main .filters button { min-height: 46px; }
    .admin-main .filters > a { padding: 10px; text-align: center; }
    .admin-main .section-heading { gap: 16px; flex-wrap: wrap; }
    .admin-main table { min-width: 600px; }
    .admin-main .inline-form { flex-wrap: wrap; }
    .tabs { gap: 20px; overflow-x: auto; padding: 4px 2px; }
    .tabs button { flex-shrink: 0; min-height: 44px; white-space: nowrap; }
}

@media (max-width: 768px) {
    html { scroll-padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px)); }
    .site-body { padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px)) !important; }
    .container { width: calc(100% - 32px); }
    .site-header .nav { height: 72px; }
    .site-header .nav-book { display: none; }
    .site-header .brand { min-width: 0; gap: 10px; }
    .site-header .brand strong { font-size: 15px; }
    .site-header .brand small { font-size: 9px; }
    .site-header .brand-mark { flex: 0 0 40px; width: 40px; height: 40px; }
    .topbar .container { gap: 12px; font-size: 9px; }
    .topbar a { flex-shrink: 0; }
    .split, .doctor-about-grid, .footer-grid, .experience-grid, .form-grid { grid-template-columns: minmax(0, 1fr); }
    .doctor-about-grid .credentials-card, .footer-grid > div:first-child { grid-column: auto; }
    .doctor-profile-card { position: relative; max-width: 100%; }
    .section { padding-top: 30px; padding-bottom: 30px; }
    .section-heading { align-items: flex-start; flex-wrap: wrap; gap: 14px; }
    .section-heading h1, .page-heading h1 { font-size: 27px; line-height: 1.6; }
    .section-heading h2 { font-size: 24px; }
    .page-heading { padding: 28px 0; }
    input, textarea, select { font-size: 16px; min-height: 48px; }
    .site-body input, .site-body textarea, .site-body select,
    .admin-body input, .admin-body textarea, .admin-body select,
    .login-body input, .login-body textarea, .login-body select { font-size: 16px; }
    label { line-height: 1.9; }
    .check { align-items: flex-start; gap: 10px; min-height: 44px; }
    .check input { margin-top: 5px; }
    .button, button { min-height: 44px; }
    .card, .sticky-card { padding: 20px; }
    .booking-form { padding: 20px 16px; }
    .booking-form h2 { font-size: 19px; line-height: 1.8; }
    .booking-form .steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; font-size: 10px; line-height: 1.9; }
    .clinic-picker { grid-template-columns: minmax(0, 1fr); margin: 18px 0 24px; }
    .clinic-option { padding: 16px; }
    .clinic-option strong { font-size: 16px; }
    .slot-days { max-height: 420px; padding: 3px; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; }
    .slot-days fieldset { min-width: 0; padding: 12px; }
    .slot-days legend { font-size: 14px; }
    .slot-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    .slot-option { min-width: 0; }
    .slot-option span { min-width: 0; min-height: 58px; padding: 8px 4px; }
    .slot-option b { font-size: 15px; }
    .slot-option small { font-size: 10px; }
    .booking-form .full { position: static; min-height: 54px; padding: 13px 16px; font-size: 14px; line-height: 1.9; margin-top: 16px; }
    .booking-grid > aside { order: 2; }
    .contact-grid { gap: 12px; }
    .contact-grid .phone-big { font-size: 27px; }
    .contact-grid .button, .contact-grid form > button { width: 100%; }
    .filters { display: grid; grid-template-columns: minmax(0, 1fr); }
    .filters label { min-width: 0; }
    .filters button { width: 100%; }
    .reading-grid { gap: 20px; }
    .article-title { font-size: 27px; }
    .prose { font-size: 16px; }
    .success-card { padding: 24px 18px; }
    .success-card h1 { font-size: 25px; line-height: 1.7; }
    .tracking { padding: 14px 10px; font-size: 18px; }
    .pagination { gap: 12px; flex-wrap: wrap; }
    .pagination a { min-height: 44px; padding: 9px 14px; }
    .contact-summary-items { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
    .contact-summary-items b { font-size: 13px; }
    .contact-summary .button { width: 100%; }
    .footer-grid { gap: 24px; }
    .footer-address { max-width: none; }
    .footer-grid > div:first-child p { max-width: none; }
    .footer-bottom { gap: 12px; flex-wrap: wrap; }
    .mobile-bottom-nav {
        height: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
        min-height: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
        padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px)) !important;
    }
    .mobile-bottom-nav a, .mobile-bottom-nav .mobile-appointment { height: 58px !important; min-height: 58px !important; }
    .mobile-bottom-nav .appointment-icon { position: relative; display: block; border: 2px solid currentColor; border-radius: 5px; font-size: 0; }
    .mobile-bottom-nav .appointment-icon:before { content: ''; position: absolute; top: 4px; inset-inline: -2px; border-top: 2px solid currentColor; }
    .mobile-bottom-nav .appointment-icon:after { content: ''; position: absolute; top: -5px; right: 3px; width: 3px; height: 6px; background: currentColor; border-radius: 3px; box-shadow: 9px 0 0 currentColor; }
    .social-dock { display: none; }
    .admin-main { padding: 20px 16px; }
    .sidebar { padding: 18px 16px; }
    .admin-header { padding: 14px 16px; flex-wrap: wrap; gap: 10px; }
    .admin-header .user-chip { margin-inline-start: auto; }
    .admin-footer { padding: 20px 16px; gap: 12px; flex-wrap: wrap; }
    .admin-main .filters { grid-template-columns: minmax(0, 1fr); padding: 16px; }
    .admin-main .filters input, .admin-main .filters select { font-size: 16px; }
    .admin-main .inline-form input, .admin-main .inline-form select { font-size: 16px; min-height: 44px; }
    .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .stat { padding: 14px 10px; }
    .stat b { font-size: 27px; overflow-wrap: anywhere; }
    .stat > span { font-size: 11px; }
    .stat small { font-size: 9px; }
    .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .editor-footer { flex-wrap: wrap; gap: 10px; }
    .tabs { flex-wrap: wrap; gap: 8px; overflow: visible; }
    .tabs button { flex: 1 1 90px; white-space: normal; padding: 10px 8px; border: 1px solid #dcebf4; border-radius: 10px; box-shadow: none; line-height: 1.8; }
    .tabs button.active { background: #087cc4; color: #fff; border-color: #087cc4; }
    .score-metrics { gap: 12px; }
    .weekly-plan fieldset { padding: 12px; }
    .hours-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .list-row { gap: 12px; flex-wrap: wrap; }
    .quick-links { display: grid; grid-template-columns: minmax(0, 1fr); }
    .login-body { grid-template-columns: minmax(0, 1fr); min-height: 100svh; }
    .login-decoration { display: none; }
    .login-card { width: 100%; max-width: 460px; padding: 30px 22px; margin: auto; min-height: 0; }
    .login-card .brand { margin-bottom: 30px; }
    .otp-body { padding: 24px 16px; }
    .otp-body .login-card { max-width: 100%; }
    .auth-page main { min-height: 0; }
}

@media (max-width: 480px) {
    .next-hero-copy h1 { font-size: clamp(32px, 10vw, 43px); letter-spacing: -1.3px; }
    .next-service-grid, .service-grid { grid-template-columns: minmax(0, 1fr); }
    .next-service-grid .service-card { min-height: 220px; }
    .next-service-grid h3 { font-size: 18px; }
    .next-service-grid p { font-size: 13px; }
    .next-hero-copy .actions { display: grid; grid-template-columns: minmax(0, 1fr); }
    .hero-proof { gap: 0; }
    .hero-proof > div { flex: 1; min-width: 0; padding-inline: 8px; }
    .hero-proof span { font-size: 9px; }
    .clean-visual .hero-doctor-frame { max-width: calc(100% - 24px); }
    .hero-booking-card { max-width: calc(100% - 12px); }
    .experience-stamp { left: 0; }
    .doctor-profile-card { display: block; padding: 9px; }
    .doctor-profile-card > img { height: auto; aspect-ratio: 4/3; object-position: center 25%; }
    .doctor-profile-card > div { margin: -28px 10px 0; }
    .profile-phone { flex-wrap: wrap; gap: 8px; }
    .account-heading h1 { font-size: 27px; }
    .auth-bottom { flex-wrap: wrap; }
}

@media (max-width: 650px) {
    .appointment-table table { display: block; min-width: 0; }
    .appointment-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); clip-path: inset(50%); }
    .appointment-table tbody { display: grid; gap: 16px; }
    .appointment-table tr { display: block; min-width: 0; padding: 8px 12px; border: 1px solid #dcebf4; border-radius: 14px; }
    .appointment-table td { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 10px; align-items: start; padding: 12px 0; font-size: 13px; }
    .appointment-table td:last-child { border-bottom: 0; }
    .appointment-table td:before { content: attr(data-label); color: #638096; font-size: 11px; }
    .appointment-table td > div { min-width: 0; }
    .appointment-table td a { padding: 6px 0; font-size: 14px; width: fit-content; }
    .appointment-table .inline-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 9px; }
    .appointment-table .inline-form select { width: 100%; min-width: 0; max-width: none; font-size: 16px; }
    .appointment-table .inline-form button { width: 100%; min-height: 44px; }
    .appointment-table td.empty { display: block; }
    .appointment-table td.empty:before { content: none; }
}

@media (pointer: coarse) {
    .button:hover, button:hover, .article-card:hover, .service-card:hover { transform: none; }
}
