/* LiverCare AI shared responsive hardening.
   Page styles retain visual ownership; this file supplies cross-screen safety. */

/* Do not force a desktop minimum width: a visible vertical scrollbar would
   otherwise create horizontal overflow on 320px phones. */
html { min-width: 0; }

:root {
  --lc-z-content: 1;
  --lc-z-sticky: 100;
  --lc-z-dropdown: 300;
  --lc-z-backdrop: 500;
  --lc-z-drawer: 600;
}
body { overflow-x: hidden; }
img, video, canvas { max-width: 100%; height: auto; }
svg { max-width: 100%; }

.pt-main,
.dd-main,
main,
section,
article,
form,
fieldset,
table,
thead,
tbody,
tr,
td,
th { min-width: 0; }

input,
select,
textarea,
button { max-width: 100%; }

textarea { resize: vertical; }

:where(a, button, input, select, textarea):focus-visible {
  outline: 2px solid rgba(22, 112, 240, 0.62);
  outline-offset: 3px;
}

.pt-topbar,
.dd-topbar {
  position: sticky;
  top: 8px;
  z-index: var(--lc-z-sticky);
}

/* Mobile navigation is a modal drawer: it must sit over all cards and its
   backdrop must still block the page below it. */
.pt-scrim,
.dd-scrim { z-index: var(--lc-z-backdrop); }

.pt-sidebar,
.dd-sidebar { z-index: var(--lc-z-drawer); }

.pt-usermenu,
.dd-usermenu {
  max-width: min(320px, calc(100vw - 24px));
}

[role="dialog"] {
  max-width: min(680px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.hh-table-wrap,
.dp-table-wrap,
.av-table-wrap {
  scrollbar-width: thin;
  scrollbar-color: #9cb9dc #edf4fc;
  overscroll-behavior-inline: contain;
}

.hh-table-wrap::-webkit-scrollbar,
.dp-table-wrap::-webkit-scrollbar,
.av-table-wrap::-webkit-scrollbar { height: 8px; }
.hh-table-wrap::-webkit-scrollbar-track,
.dp-table-wrap::-webkit-scrollbar-track,
.av-table-wrap::-webkit-scrollbar-track { background: #edf4fc; }
.hh-table-wrap::-webkit-scrollbar-thumb,
.dp-table-wrap::-webkit-scrollbar-thumb,
.av-table-wrap::-webkit-scrollbar-thumb { border: 2px solid #edf4fc; border-radius: 999px; background: #9cb9dc; }

@media (max-width: 1024px) {
  .pt-topbar,
  .dd-topbar { top: 6px; }

  .pt-body h1,
  .dd-body h1 { text-wrap: balance; }
}

@media (max-width: 760px) {
  .pt-app,
  .dd-app { width: 100%; }

  .pt-topbar,
  .dd-topbar { top: 4px; }

  .pt-body main,
  .dd-body main { max-width: 100%; }

  .pt-body :where(button, .pt-bell, .pt-menu),
  .dd-body :where(button, .dd-bell, .dd-menu) { min-height: 40px; }

  .pt-body :where(input, select, textarea),
  .dd-body :where(input, select, textarea),
  .dr-body :where(input, select, textarea),
  .acc-body :where(input, select, textarea) { font-size: 16px !important; }

  .hh-table-wrap { overflow: visible; padding: 8px; }
  .hh-table { display: block; min-width: 0; }
  .hh-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .hh-table tbody { display: grid; gap: 10px; }
  .hh-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    overflow: hidden;
    border: 1px solid #e2ebf7;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(22, 76, 150, 0.05);
  }
  .hh-row td {
    display: grid;
    grid-template-columns: minmax(88px, .75fr) minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 9px 11px !important;
    border: 0 !important;
    border-bottom: 1px solid #edf3fa !important;
    background: transparent !important;
  }
  .hh-row td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--pt-sub, #4d5d82);
  }
  .hh-row td:nth-child(odd) { border-right: 1px solid #edf3fa !important; }
  .hh-row td:nth-last-child(-n + 2) { border-bottom: 0 !important; }
  .hh-when { display: grid; }
  .hh-type { white-space: normal; }
  .hh-type__icon { display: none; }
  .hh-status,
  .hh-result { justify-self: start; white-space: normal; }
  .hh-details { justify-self: start; min-height: 36px; }
  .hh-table tbody tr:not(.hh-row) { display: block; }
  .hh-empty { display: block; width: 100%; }

  .av-scroll-hint {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 8px 0;
    color: var(--dd-sub, #55658d);
    font-size: 12.5px;
  }
  .av-scroll-hint svg { width: 17px; height: 17px; flex: 0 0 auto; color: var(--dd-blue, #1670f0); }
  .av-table-wrap { border: 1px solid #e2ebf7; border-radius: 12px; }
  .av-table .av-th-time,
  .av-table .av-time {
    position: sticky;
    left: 0;
    z-index: 3;
    box-shadow: 4px 0 8px rgba(22, 76, 150, 0.06);
  }
  .av-table .av-th-time { z-index: 4; }
}

@media (max-width: 480px) {
  .hh-row { grid-template-columns: 1fr; }
  .hh-row td:nth-child(odd) { border-right: 0 !important; }
  .hh-row td:nth-last-child(2) { border-bottom: 1px solid #edf3fa !important; }
  .hh-row td:last-child { border-bottom: 0 !important; }

  .pt-usermenu,
  .dd-usermenu { right: 0; left: auto; }
}

@media (prefers-reduced-motion: reduce) {
  html:focus-within { scroll-behavior: auto; }
}
