* { box-sizing: border-box; }
html, body { min-width: 320px; min-height: 100%; }
html { background: #06131d; font-size: 17px; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--surface-soft); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; opacity: .58; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 9px; font-size: clamp(1.8rem, 5vw, 2.65rem); line-height: 1.06; letter-spacing: -.04em; font-weight: 620; }
h2 { margin-bottom: 7px; font-size: 1.24rem; line-height: 1.2; font-weight: 620; letter-spacing: -.02em; }
h3 { margin-bottom: 5px; font-size: 1rem; font-weight: 610; }
p { margin-bottom: 0; color: var(--muted); line-height: 1.52; }
.app-shell { min-height: 100dvh; }
.content-main { min-height: 100dvh; padding: calc(var(--header-height) + env(safe-area-inset-top) + 18px) 18px calc(var(--footer-height) + env(safe-area-inset-bottom) + 22px); }
.page-container { width: min(100%, var(--page-max)); margin: 0 auto; }
.narrow-page { max-width: 760px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-heading p { max-width: 660px; }
.page-kicker { display: inline-block; margin-bottom: 7px; color: var(--red); font-size: .69rem; font-weight: 760; letter-spacing: .15em; text-transform: uppercase; }
.page-kicker.light { color: rgba(255,255,255,.72); }
.surface-card { padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,.96); box-shadow: var(--shadow-sm); }
.section-heading, .card-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 24px 0 13px; }
.card-heading { margin-top: 0; }
.primary-button, .secondary-button, .outline-button, .danger-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 46px; padding: 0 17px; border-radius: 14px; font-weight: 650; border: 1px solid transparent; }
.primary-button { color: white; background: linear-gradient(145deg, #ff2c35, #d60e18); box-shadow: 0 10px 22px rgba(222,20,29,.22); }
.secondary-button { color: var(--ink-2); background: white; border-color: var(--line); }
.outline-button { color: var(--ink-2); background: white; border-color: #d7dade; }
.danger-button { color: white; background: radial-gradient(circle at 30% 10%, #ff4d56, #d70b16 58%, #9b0710); box-shadow: 0 13px 34px rgba(213,12,24,.3); }
.full { width: 100%; }
.large { min-height: 56px; font-size: 1rem; }
.text-link, .text-action { padding: 0; border: 0; color: var(--red); background: none; font-weight: 650; }
.field { display: grid; gap: 7px; margin-bottom: 16px; color: #363a42; font-size: .8rem; font-weight: 620; }
.field-control { display: flex; align-items: center; gap: 10px; min-height: 49px; padding: 0 13px; border: 1px solid #d9dde2; border-radius: 14px; color: #7a8089; background: white; transition: border-color .18s ease, box-shadow .18s ease; }
.field-control:focus-within { border-color: #9da4ad; box-shadow: 0 0 0 4px rgba(19,25,34,.06); }
.field input, .field textarea { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--ink); background: transparent; resize: vertical; }
.field textarea { min-height: 98px; padding: 13px; border: 1px solid #d9dde2; border-radius: 14px; background: white; }
.field-icon-button { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; color: #777d86; background: transparent; }
.consent-row { display: flex; align-items: flex-start; gap: 9px; margin: 15px 0; color: #50555e; font-size: .82rem; line-height: 1.4; }
.consent-row input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--red); }
.live-chip, .muted-chip, .status-chip, .membership-badge { display: inline-flex; align-items: center; gap: 7px; min-height: 27px; padding: 0 10px; border-radius: 999px; font-size: .72rem; font-style: normal; font-weight: 650; }
.live-chip { color: #16763b; background: #eaf8ef; }
.live-chip i { width: 7px; height: 7px; border-radius: 50%; background: #1aa84b; }
.muted-chip { color: #6f747d; background: #eef0f2; }
.toast-root { position: fixed; z-index: 500; top: calc(env(safe-area-inset-top) + 16px); left: 50%; display: grid; gap: 8px; width: min(calc(100% - 28px), 460px); transform: translateX(-50%); pointer-events: none; }
.toast { padding: 13px 16px; border: 1px solid rgba(255,255,255,.13); border-radius: 14px; color: white; background: rgba(18,21,27,.96); box-shadow: 0 18px 38px rgba(0,0,0,.26); opacity: 0; transform: translateY(-10px); transition: opacity .2s ease, transform .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: #137a39; }
.toast-error { background: #a90f18; }
.toast-warning { background: #936200; }
.loading-row, .empty-state { padding: 28px; color: var(--muted); text-align: center; }
@media (max-width: 680px) {
  :root { --header-height: 56px; --footer-height: 90px; }
  .content-main { padding-left: 12px; padding-right: 12px; padding-top: calc(var(--header-height) + env(safe-area-inset-top) + 14px); }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .surface-card { padding: 17px; border-radius: 19px; }
}

body.home-page-active { width:100%; height:100dvh; overflow:hidden; overscroll-behavior:none; background:#dbe5ec; }
body.home-page-active #app { width:100%; height:100%; overflow:hidden; }


/* TrackSOS v1.1.203 app-wide readability and overflow safety */
body { line-height: 1.45; }
:where(.content-main, .home-main) :where(section, article, div, form, fieldset, label) { min-width: 0; }
:where(.content-main, .home-main) :where(h1, h2, h3, p, small, strong, label, button) {
  overflow-wrap: anywhere;
  word-break: normal;
}
:where(.content-main, .home-main) :where(button, .primary-button, .secondary-button, .outline-button, .danger-button) {
  max-width: 100%;
  white-space: normal;
}
:where(.content-main, .home-main) :where(input, textarea, select) {
  max-width: 100%;
  font-size: 16px;
}
body.inner-page-active .content-main p,
body.home-page-active .home-main p { font-size: max(.9em, 15px); }
body.inner-page-active .content-main small,
body.home-page-active .home-main small { font-size: max(.82em, 13.5px); line-height: 1.42; }
body.inner-page-active .content-main label,
body.home-page-active .home-main label { font-size: max(.88em, 14.5px); }
body.inner-page-active .content-main strong,
body.home-page-active .home-main strong { font-size: max(.88em, 14.5px); }
body.inner-page-active .content-main button:not([aria-label]),
body.home-page-active .home-main button:not([aria-label]) { font-size: max(.88em, 14.5px); }
.field { font-size: .9rem; }
.field-control { min-height: 52px; }
.primary-button, .secondary-button, .outline-button, .danger-button { font-size: .94rem; }
.page-kicker { font-size: .76rem; }
@media (max-width: 360px) {
  html { font-size: 16.5px; }
  .content-main { padding-left: 10px; padding-right: 10px; }
}

/* TrackSOS v1.1.203 larger app-wide typography with width-safe wrapping */
html { font-size: 18px; }
.content-main--wide { padding-right: 10px; padding-left: 10px; }
.content-main--wide > .page-container { width: 100%; max-width: none; }
body.inner-page-active .content-main p,
body.home-page-active .home-main p { font-size: max(.9em, 16px); }
body.inner-page-active .content-main small,
body.home-page-active .home-main small { font-size: max(.8em, 14px); line-height: 1.45; }
body.inner-page-active .content-main label,
body.home-page-active .home-main label,
body.inner-page-active .content-main strong,
body.home-page-active .home-main strong { font-size: max(.86em, 15px); }
body.inner-page-active .content-main button:not([aria-label]),
body.home-page-active .home-main button:not([aria-label]) { font-size: max(.86em, 15px); line-height: 1.25; }
:where(.content-main, .home-main) :where(input, textarea, select) { font-size: 17px; }
.page-kicker { font-size: .78rem; }
.field { font-size: .92rem; }
.primary-button, .secondary-button, .outline-button, .danger-button { font-size: .96rem; }
@media (max-width: 680px) {
  html { font-size: 17.5px; }
  .content-main--wide { padding-right: 8px; padding-left: 8px; }
}
@media (max-width: 360px) {
  html { font-size: 17px; }
  .content-main--wide { padding-right: 6px; padding-left: 6px; }
}

/* TrackSOS v1.1.220 reliability status */
.reliability-banner {
  position: fixed;
  z-index: 860;
  top: calc(var(--header-height) + env(safe-area-inset-top) + 7px);
  right: 12px;
  left: 12px;
  display: grid;
  grid-template-columns: 10px minmax(0,1fr) auto;
  align-items: center;
  gap: 10px;
  width: min(calc(100% - 24px), 760px);
  min-height: 54px;
  margin: 0 auto;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 16px;
  color: #fff;
  background: rgba(18,24,32,.97);
  box-shadow: 0 15px 34px rgba(0,0,0,.24);
  backdrop-filter: blur(14px);
}
.reliability-banner[hidden] { display: none; }
.reliability-banner__indicator { width: 9px; height: 9px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px rgba(255,255,255,.13); }
.reliability-banner__copy { display: grid; gap: 2px; min-width: 0; }
.reliability-banner__copy strong { color: inherit; font-size: 14px; line-height: 1.2; }
.reliability-banner__copy small { color: rgba(255,255,255,.86); font-size: 12px; line-height: 1.3; }
.reliability-banner button { min-height: 34px; padding: 0 11px; border: 1px solid rgba(255,255,255,.36); border-radius: 10px; color: inherit; background: rgba(255,255,255,.12); font-size: 12px; font-weight: 760; white-space: nowrap; }
.reliability-banner--critical { color: #fff; background: rgba(164,10,20,.98); }
.reliability-banner--offline { color: #fff; background: rgba(46,52,61,.98); }
.reliability-banner--success { color: #fff; background: rgba(13,117,55,.98); }
@media (max-width: 540px) {
  .reliability-banner { right: 8px; left: 8px; width: calc(100% - 16px); grid-template-columns: 9px minmax(0,1fr); }
  .reliability-banner button { grid-column: 2; justify-self: start; }
}

/* TrackSOS shared dialog and keyboard support */
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.skip-link { position:fixed; z-index:2000; top:8px; left:8px; padding:12px 16px; border-radius:12px; color:#fff; background:#111820; box-shadow:var(--shadow); transform:translateY(-150%); transition:transform .18s ease; }
.skip-link:focus { transform:translateY(0); }
:where(button,a,input,select,textarea,[tabindex]):focus-visible { outline:3px solid #1976d2; outline-offset:3px; }
:where(button,.primary-button,.secondary-button,.outline-button,.danger-button,.text-action) { min-height:44px; }
html.ux-high-contrast :where(button,a,input,select,textarea,[tabindex]):focus-visible { outline-color:#005fcc; outline-width:4px; }
.dialog-open { overflow:hidden; }
.app-dialog-backdrop { position:fixed; z-index:1900; inset:0; display:grid; place-items:center; padding:18px; background:rgba(8,12,18,.67); backdrop-filter:blur(8px); }
.app-dialog { width:min(100%,520px); padding:22px; border:1px solid rgba(255,255,255,.4); border-radius:24px; background:#fff; box-shadow:0 28px 80px rgba(0,0,0,.36); }
.app-dialog header { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; }
.app-dialog h2 { margin-bottom:0; }
.app-dialog > p { margin:16px 0; color:#343a42; font-size:1rem; }
.app-dialog-detail { margin:0 0 16px; padding:12px 14px; border-radius:14px; color:#5c4100; background:#fff5cf; }
.app-dialog footer { display:flex; justify-content:flex-end; flex-wrap:wrap; gap:10px; margin-top:20px; }
.app-dialog-close { display:grid; place-items:center; width:44px; height:44px; border:1px solid var(--line); border-radius:50%; background:#fff; font-size:1.4rem; }
.reliability-banner__copy strong { font-size:15px; }
.reliability-banner__copy small { font-size:13px; }
.reliability-banner button { min-height:42px; font-size:13px; }
@media (max-width:540px){ .app-dialog footer > button { flex:1 1 150px; } }
