/* Touch controls and responsive layouts shared by login and the dashboard. */
button, summary, a, input, select { -webkit-tap-highlight-color: transparent; }
button, summary { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
.directory-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.directory-pagination span { font-size: 12px; color: var(--muted); }
.directory-pagination button { min-height: 44px; }
.directory-table table { min-width: 0; }

@media (pointer: coarse) {
  button, input:not([type=hidden]), select { min-height: 44px; }
  input:not([type=hidden]), select { font-size: 16px !important; }
  summary { min-height: 44px; padding-block: 12px; }
}

@media (max-width: 800px) {
  html { -webkit-text-size-adjust: 100%; }
  body { overflow-wrap: break-word; }
  button { min-height: 44px; }
  input:not([type=hidden]), select { min-height: 48px; font-size: 16px !important; }
  .topbar {
    height: auto; min-height: 68px;
    padding: max(8px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
    gap: 12px;
  }
  .brand { font-size: 24px; }
  .brand-sub { font-size: 9px; margin-left: 8px; padding-left: 10px; }
  .account > span { display: none; }
  .account .text-button { padding: 10px 6px; font-size: 13px; }
  .dashboard { padding: 26px max(16px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .page-heading { display: block; margin-bottom: 22px; }
  h1 { font-size: 32px; }
  .page-heading > div:first-child > .muted { font-size: 14px; line-height: 1.6; margin-bottom: 4px; }
  .directory-jump { font-size: 14px; min-height: 44px; padding: 12px 0; margin: 0; }
  .update-panel { flex-direction: row; align-items: center; justify-content: space-between; max-width: none; gap: 12px; margin-top: 10px; font-size: 12px; }
  .update-panel button { font-size: 13px; white-space: nowrap; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; padding: 0; margin-bottom: 22px; }
  .summary > div { padding: 17px; }
  .summary > div:nth-child(2) { border-right: 0; }
  .summary > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .summary-label { display: block; font-size: 10px; letter-spacing: .7px; min-height: 30px; line-height: 1.5; }
  .summary strong { font-size: 28px; margin-top: 5px; }
  .toolbar { flex-direction: column; align-items: stretch; gap: 12px; }
  .filters { display: grid; grid-template-columns: 1fr 1.3fr .8fr; gap: 5px; }
  .filter { font-size: 12px; padding: 8px 5px; }
  .toolbar-tools { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; margin: 0; gap: 10px; }
  .toolbar-tools .search, .toolbar-tools .search input { width: 100%; min-width: 0; }
  .view-switch { display: grid; grid-template-columns: 1fr 1fr; }
  .view-switch button { font-size: 13px; padding: 9px; }
  .service-grid { gap: 14px; }
  .service-card { padding: 18px; }
  .service-card h2 { font-size: 18px; line-height: 1.4; }
  .service-description { font-size: 13px; min-height: 0; }
  .badge { font-size: 11px; }
  .components { font-size: 13px; margin-bottom: 14px; }
  .components summary { min-height: 44px; padding: 12px 0; }
  .component { font-size: 12px; line-height: 1.75; }
  .endpoint-check { font-size: 13px; line-height: 1.65; }
  .check-time { font-size: 12px; }
  .controls { gap: 8px; }
  .action { min-height: 46px; font-size: 13px; }
  .read-only { font-size: 12px; }
  .service-list .service-card { grid-template-columns: minmax(0, 1fr) max-content; padding: 16px; }
  .service-list .service-card h2 { font-size: 16px; }
  .service-list .service-description { font-size: 13px; }
  .service-list .badge { font-size: 11px; max-width: 135px; white-space: normal; text-align: center; }
  .service-list .action { flex: 1; }
  .extras { padding: 16px; margin-top: 20px; }
  .extras > summary { min-height: 48px; padding: 9px 0; font-size: 15px; line-height: 1.6; }
  .extras > summary span { display: block; margin: 5px 0 0 17px; font-size: 12px; }
  .extras > p { font-size: 13px; line-height: 1.75; }
  .extra-row { font-size: 13px; line-height: 1.6; gap: 5px; flex-direction: column; padding: 12px 0; }
  .directory-toolbar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; scroll-margin-top: 16px; }
  .directory-search { min-width: 0; max-width: none; }
  .directory-type select { width: 100%; max-width: none; }
  .directory-toolbar > span { margin: 0; font-size: 12px; }
  .directory-table { max-height: none; overflow: visible; border: 0; background: transparent; }
  .directory-table table, .directory-table tbody, .history table, .history tbody { display: block; min-width: 0; width: 100%; white-space: normal; }
  .directory-table thead, .history thead {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap;
  }
  .directory-table tr, .history tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .directory-table tr { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 12px; background: #fafcf9; }
  .directory-table td, .history td { display: block; width: auto; border: 0; padding: 7px 6px; font-size: 13px; line-height: 1.65; overflow-wrap: anywhere; min-width: 0; }
  .directory-table td::before, .history td::before { content: attr(data-label); display: block; font-size: 10px; font-weight: 600; letter-spacing: .5px; color: var(--muted); margin-bottom: 3px; }
  .directory-table td:nth-child(1), .directory-table td:nth-child(4), .directory-table td:nth-child(5), td[colspan] { grid-column: 1 / -1; }
  .directory-address a { display: inline-block; padding: 6px 0; min-height: 44px; }
  .directory-service { min-height: 44px; padding: 5px 0; font-size: 13px; }
  .directory-destination p { font-size: 12px; line-height: 1.65; }
  .directory-pagination { gap: 8px; }
  .directory-pagination button { font-size: 13px; padding: 10px 12px; }
  .directory-foot { font-size: 12px !important; }
  .history { margin-top: 26px; }
  .section-heading { gap: 15px; }
  .section-heading h2 { font-size: 18px; }
  .section-heading span { font-size: 12px; }
  .history .table-wrap { max-height: 28rem; overflow: auto; }
  .history tr { padding: 10px; border-bottom: 1px solid var(--line); }
  .history tr:last-child { border-bottom: 0; }
  .dashboard-footer { align-items: center; flex-direction: column; gap: 10px; font-size: 12px; margin-top: 18px; }
  dialog { inset: auto 12px max(12px, env(safe-area-inset-bottom)); width: auto; max-width: none; max-height: calc(100dvh - 32px); margin: 0; padding: 24px; overflow-y: auto; }
  dialog h2 { font-size: 24px; line-height: 1.35; overflow-wrap: anywhere; }
  dialog p { font-size: 14px; }
  .dialog-close { width: 44px; height: 44px; margin: -10px -10px 0 0; }
  .dialog-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .dialog-buttons button { min-height: 48px; padding: 10px; font-size: 14px; }
  .login-layout { display: block; }
  .login-intro { padding: max(24px, env(safe-area-inset-top)) 24px 20px; min-height: 0; }
  .intro-copy { margin: 25px 0 0; }
  .intro-copy h1 { font-size: 29px; letter-spacing: -1px; }
  .intro-copy .eyebrow { font-size: 10px; margin-bottom: 12px; }
  .intro-copy > p:last-child, .login-intro > .quiet, .lock-icon { display: none; }
  .login-panel { padding: 28px 24px max(28px, env(safe-area-inset-bottom)); }
  .login-card { max-width: 440px; }
  .login-card h2 { font-size: 26px; }
  .login-card label { font-size: 14px; }
  .login-card input:not([type=hidden]) { min-height: 48px; font-size: 16px; }
  .login-button { min-height: 48px; font-size: 16px; }
  .login-foot { font-size: 12px; }
}

@media (max-width: 650px) {
  .service-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
