:root {
  color-scheme: light;
  --navy-950: #061a35;
  --navy-900: #082247;
  --navy-800: #0d315f;
  --blue-700: #075db9;
  --blue-600: #0b6dd7;
  --blue-100: #e6f1ff;
  --green-700: #08784d;
  --green-600: #0b915d;
  --green-100: #e5f6ee;
  --amber-600: #d58a00;
  --amber-100: #fff4d8;
  --red-600: #be3c45;
  --ink: #0a1e3d;
  --muted: #52627a;
  --line: #d9e1eb;
  --line-strong: #c7d1df;
  --surface: #ffffff;
  --canvas: #f4f7fb;
  --shadow: 0 10px 30px rgba(8, 34, 71, .07);
  --radius: 12px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
button, input, select { font: inherit; }
button, a, select, input { -webkit-tap-highlight-color: transparent; }
button, select { cursor: pointer; }
a { color: var(--blue-700); text-underline-offset: 3px; }
[hidden] { display: none !important; }
.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; }

.brand { display: inline-flex; align-items: center; gap: 11px; color: #fff; font-size: 25px; font-weight: 790; letter-spacing: -.04em; text-decoration: none; }
.brand.dark { color: var(--ink); }
.brand-mark { display: inline-flex; align-items: flex-end; gap: 3px; width: 27px; height: 27px; padding: 5px; border-radius: 7px; background: linear-gradient(145deg, #fff, #d9edff); box-shadow: 0 5px 16px rgba(0, 0, 0, .12); }
.brand-mark i { display: block; width: 4px; border-radius: 3px; background: var(--blue-700); }
.brand-mark i:nth-child(1) { height: 8px; }
.brand-mark i:nth-child(2) { height: 16px; }
.brand-mark i:nth-child(3) { height: 12px; }

.eyebrow { margin: 0 0 7px; color: var(--blue-700); font-size: 11px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(30px, 4vw, 43px); line-height: 1.05; letter-spacing: -.045em; }
h2 { margin-bottom: 7px; font-size: 21px; line-height: 1.18; letter-spacing: -.025em; }
h3 { margin-bottom: 7px; font-size: 16px; }
p { color: var(--muted); line-height: 1.55; }

.auth-view { min-height: 100vh; display: grid; grid-template-columns: minmax(400px, .9fr) minmax(520px, 1.1fr); background: #fff; }
.auth-story { position: relative; display: flex; min-height: 100vh; flex-direction: column; justify-content: space-between; padding: clamp(28px, 5vw, 72px); overflow: hidden; color: #fff; background: radial-gradient(circle at 90% 15%, rgba(20, 114, 211, .55), transparent 35%), linear-gradient(145deg, #061a35, #0b3564); }
.auth-story::after { content: ""; position: absolute; right: -160px; bottom: -190px; width: 520px; height: 520px; border: 1px solid rgba(255,255,255,.13); border-radius: 50%; box-shadow: 0 0 0 70px rgba(255,255,255,.025), 0 0 0 140px rgba(255,255,255,.02); }
.auth-pitch, .trust-list, .auth-story .brand { position: relative; z-index: 1; }
.auth-pitch { max-width: 520px; }
.auth-pitch .eyebrow { color: #8fc8ff; }
.auth-pitch h1 { margin-bottom: 20px; font-size: clamp(48px, 6vw, 78px); line-height: .98; }
.auth-pitch p:not(.eyebrow) { color: #d8e7f7; font-size: 19px; }
.trust-list { display: flex; flex-wrap: wrap; gap: 14px 24px; margin: 0; padding: 0; list-style: none; color: #d8e7f7; font-size: 14px; }
.trust-list span { color: #77e0ad; font-weight: 800; }
.auth-panel { display: flex; min-height: 100vh; flex-direction: column; justify-content: center; padding: 42px clamp(28px, 8vw, 130px) 22px; background: linear-gradient(180deg, #fff, #f8fafe); }
.auth-card { width: min(100%, 500px); margin: auto; }
.auth-topline { display: flex; align-items: center; justify-content: space-between; }
.auth-card h2 { margin: 10px 0 8px; font-size: 38px; }
.auth-intro { margin-bottom: 26px; }
.language-picker select { min-width: 63px; height: 38px; padding: 0 26px 0 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: #fff; font-weight: 750; }

form { display: grid; gap: 15px; }
label { display: grid; gap: 7px; color: var(--ink); font-size: 13px; font-weight: 720; }
input, select { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--ink); background: #fff; outline: none; transition: border-color .16s, box-shadow .16s; }
input:focus, select:focus { border-color: var(--blue-600); box-shadow: 0 0 0 3px rgba(11, 109, 215, .13); }
input::placeholder { color: #8b98a9; }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 82px; }
.password-toggle { position: absolute; top: 6px; right: 6px; height: 32px; border: 0; color: var(--blue-700); background: transparent; font-size: 12px; font-weight: 800; }
.button { display: inline-flex; min-height: 43px; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border: 1px solid transparent; border-radius: 8px; font-weight: 800; text-decoration: none; transition: transform .14s, background .14s, border-color .14s, box-shadow .14s; }
.button:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 7px 18px rgba(8, 34, 71, .12); }
.button:disabled { cursor: not-allowed; opacity: .48; }
.button.primary { color: #fff; background: var(--blue-700); }
.button.dark { color: #fff; background: var(--navy-900); }
.button.secondary { border-color: var(--line-strong); color: var(--navy-900); background: #fff; }
.button.danger { color: #fff; background: var(--red-600); }
.button.full { width: 100%; }
.text-button { padding: 8px 0; border: 0; color: var(--blue-700); background: transparent; font-weight: 750; text-align: left; }
.secondary-auth-form, .verification-area, .legal-creation-gate { margin-top: 18px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--canvas); }
.legal-creation-gate p { margin-bottom: 12px; font-size: 13px; }
.verification-icon { display: grid; width: 46px; height: 46px; place-items: center; border-radius: 50%; color: var(--blue-700); background: var(--blue-100); font-size: 22px; }
.checkbox { display: flex; grid-template-columns: auto 1fr; align-items: flex-start; gap: 10px; }
.checkbox input { width: 17px; min-height: 17px; margin-top: 2px; }
.checkbox span { display: grid; gap: 4px; }
.checkbox small { color: var(--muted); font-weight: 500; line-height: 1.45; }
.message { margin-bottom: 16px; padding: 12px 15px; border: 1px solid #a6ddc3; border-radius: 9px; color: #07613e; background: #eaf8f1; font-size: 14px; font-weight: 680; }
.message.error { border-color: #edb6bb; color: #912c35; background: #fff0f1; }
.site-footer { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.site-footer > div { display: grid; gap: 4px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 14px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.auth-footer { width: 100%; margin-top: 40px; }

.app-view { min-height: 100vh; background: var(--canvas); }
.desktop-sidebar { position: fixed; z-index: 30; inset: 0 auto 0 0; display: flex; width: 250px; flex-direction: column; padding: 28px 18px 22px; color: #fff; background: radial-gradient(circle at 0 100%, #0b3e70, transparent 48%), linear-gradient(180deg, var(--navy-950), #082a53); box-shadow: 12px 0 35px rgba(4, 21, 43, .09); }
.sidebar-brand { margin: 0 10px 42px; }
.sidebar-label { margin: 0 12px 10px; color: #7696b9; font-size: 10px; font-weight: 800; letter-spacing: .13em; }
.desktop-nav { display: grid; gap: 7px; }
.menu-link { display: flex; width: 100%; min-height: 48px; align-items: center; gap: 12px; padding: 11px 13px; border: 0; border-radius: 8px; color: inherit; background: transparent; text-align: left; }
.desktop-nav .menu-link { color: #d7e3f1; }
.desktop-nav .menu-link:hover { color: #fff; background: rgba(255,255,255,.07); }
.desktop-nav .menu-link.active { color: #fff; background: linear-gradient(90deg, #0e64bc, #0b4e96); box-shadow: 0 8px 22px rgba(0, 0, 0, .16); }
.menu-icon { display: grid; width: 25px; height: 25px; place-items: center; font-size: 22px; font-style: normal; }
.sidebar-foot { display: grid; gap: 20px; margin-top: auto; }
.sidebar-foot small { padding: 0 12px; color: #7f9cbb; }
.logout-button { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 0; border-radius: 8px; color: #d7e3f1; background: transparent; font-weight: 700; text-align: left; }
.logout-button:hover { color: #fff; background: rgba(255,255,255,.07); }

.app-header { position: fixed; z-index: 25; top: 0; right: 0; left: 250px; display: flex; height: 68px; align-items: center; padding: 0 clamp(22px, 4vw, 54px); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.92); backdrop-filter: blur(14px); }
.app-header > .icon-button { display: none; }
.mobile-brand { display: none; }
.header-context { display: grid; gap: 2px; }
.header-context span { color: var(--blue-700); font-size: 9px; font-weight: 850; letter-spacing: .14em; }
.header-context strong { font-size: 15px; }
.header-account { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.header-account-trigger { width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; background: transparent; }
.avatar { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 50%; color: #fff; background: var(--navy-900); font-weight: 800; }
.icon-button { width: 42px; height: 42px; place-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.icon-button span { display: block; width: 19px; height: 2px; margin: 2px; background: var(--ink); }

.app-main { min-height: 100vh; margin-left: 250px; padding: 104px clamp(22px, 4vw, 54px) 28px; }
.app-message { position: fixed; z-index: 60; top: 78px; right: 26px; max-width: min(460px, calc(100vw - 40px)); box-shadow: var(--shadow); }
.page { width: min(100%, 1390px); margin: 0 auto; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 25px; }
.page-heading p:not(.eyebrow) { margin: 0; }
.page-heading h1 { margin-bottom: 6px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 1px 2px rgba(8,34,71,.02); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.panel-heading.compact { align-items: center; }
.panel-heading h2, .panel-heading p { margin-bottom: 0; }
.empty-state { margin: 0; padding: 24px; color: #718096; text-align: center; }

.relay-health { display: grid; grid-template-columns: auto minmax(220px, 1fr) auto; align-items: center; gap: 18px; min-height: 100px; margin-bottom: 20px; padding: 20px 24px; overflow: hidden; border-radius: var(--radius); color: #fff; background: linear-gradient(110deg, #087849, #0b9861); box-shadow: 0 12px 30px rgba(8, 120, 73, .18); }
.relay-health.attention { background: linear-gradient(110deg, #a96500, #d58a00); box-shadow: 0 12px 30px rgba(170, 100, 0, .18); }
.relay-health.unavailable { background: linear-gradient(110deg, #9f3340, #c74b55); box-shadow: 0 12px 30px rgba(159, 51, 64, .18); }
.relay-health-icon { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 50%; color: var(--green-700); background: #fff; font-size: 24px; font-weight: 900; }
.relay-health.attention .relay-health-icon { color: #9a5a00; }
.relay-health.unavailable .relay-health-icon { color: var(--red-600); }
.relay-health-copy h2 { margin: 0 0 4px; color: #fff; font-size: 20px; }
.relay-health-copy p { margin: 0; color: rgba(255,255,255,.88); font-size: 14px; }
.dashboard-provider-status { display: flex; align-items: stretch; gap: 10px; }
.dashboard-provider { display: grid; grid-template-columns: auto auto; align-items: center; gap: 1px 12px; min-width: 155px; padding: 11px 14px; border-radius: 8px; color: var(--ink); background: rgba(255,255,255,.96); }
.dashboard-provider strong { font-size: 13px; }
.dashboard-provider small { color: var(--muted); font-weight: 650; }
.dashboard-provider b { grid-row: 1 / 3; grid-column: 2; display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; color: #fff; background: var(--green-600); }
.dashboard-provider.warning b { background: var(--amber-600); }

.onboarding-guide { margin-bottom: 20px; padding: 23px; border-left: 4px solid var(--blue-600); }
.onboarding-heading, .onboarding-next { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.onboarding-progress { height: 7px; margin: 18px 0; overflow: hidden; border-radius: 999px; background: #e4eaf2; }
.onboarding-progress span { display: block; height: 100%; border-radius: inherit; background: var(--blue-600); transition: width .3s; }
.onboarding-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 0; list-style: none; }
.onboarding-steps li { display: flex; align-items: center; gap: 9px; color: #8490a1; }
.onboarding-steps li > span { display: grid; width: 28px; height: 28px; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: #fff; }
.onboarding-steps li.done { color: var(--green-700); }
.onboarding-steps li.done > span { color: #fff; border-color: var(--green-600); background: var(--green-600); }
.onboarding-steps li.active { color: var(--blue-700); }
.onboarding-next { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.onboarding-next p { margin: 0; }

.sync-panel { margin-bottom: 20px; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 999px; color: #5e6a7b; background: #edf1f6; font-size: 11px; font-weight: 800; white-space: nowrap; }
.pill.ok { color: var(--green-700); background: var(--green-100); }
.pill.warning { color: #955f00; background: var(--amber-100); }
.sync-choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 20px 24px; }
.sync-choice { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; padding: 18px; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfe; }
.sync-choice .button, .automatic-plan-form { grid-column: 1 / -1; }
.sync-choice-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 50%; color: var(--blue-700); background: var(--blue-100); font-size: 20px; font-weight: 850; }
.sync-choice-copy > span { color: var(--blue-700); font-size: 10px; font-weight: 850; letter-spacing: .1em; }
.sync-choice-copy h3 { margin: 3px 0; }
.sync-choice-copy p { margin: 0; font-size: 13px; }
.sync-price { white-space: nowrap; }
.sync-price small { color: var(--muted); }
.automatic-plan-form { display: grid; grid-template-columns: 1fr auto; align-items: end; }
.active-plan-controls { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px; }
.active-plan-summary { display: flex; min-width: 0; align-items: center; gap: 14px; }
.active-plan-controls p { margin: 0; }
.active-plan-controls > .active-plan-actions { display: grid; width: min(100%, 460px); flex: 0 0 460px; grid-template-columns: 1fr; align-items: stretch; gap: 10px; }
.active-plan-actions .button { width: 100%; white-space: nowrap; }
#active-plan-status { justify-self: end; }
.active-plan-footer { position: relative; border-top: 1px solid var(--line); }
.active-plan-details summary { display: flex; min-height: 62px; align-items: center; gap: 12px; padding: 16px 260px 16px 24px; color: var(--navy-900); font-weight: 750; list-style: none; cursor: pointer; }
.active-plan-details summary::-webkit-details-marker { display: none; }
.active-plan-details summary::before { content: "⌄"; color: var(--blue-700); font-size: 22px; font-weight: 850; line-height: 1; transform: rotate(-90deg); transition: transform .16s; }
.active-plan-details[open] summary::before { transform: rotate(0); }
.active-plan-details summary:hover { background: #fbfcfe; }
.active-plan-details summary:focus-visible { outline: 3px solid rgba(11,109,215,.2); outline-offset: -3px; }
.active-plan-detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.active-plan-detail-grid > div { display: grid; gap: 5px; padding: 16px 24px; border-right: 1px solid var(--line); }
.active-plan-detail-grid > div:last-child { border-right: 0; }
.active-plan-detail-grid small { color: var(--muted); }
.active-plan-footer > #active-plan-billing { position: absolute; z-index: 1; top: 10px; right: 24px; }
.sync-status-grid { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.sync-status-grid > div { display: grid; gap: 5px; padding: 16px 24px; border-right: 1px solid var(--line); }
.sync-status-grid > div:last-child { border-right: 0; }
.sync-status-grid small { color: var(--muted); }

.dashboard-actions { margin-bottom: 20px; }
.import-panel form { padding: 20px 24px 24px; }
.preview-locked { margin-bottom: 0; padding: 11px 13px; border-radius: 7px; background: var(--amber-100); color: #805100; font-size: 13px; }
fieldset { display: flex; flex-wrap: wrap; gap: 10px 18px; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 8px; }
legend { padding: 0 6px; font-size: 12px; font-weight: 800; }
fieldset .checkbox { align-items: center; }

.dashboard-operational-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; }
.dashboard-history-panel, .quick-actions-panel { min-width: 0; }
.dashboard-activity-log .activity-item { grid-template-columns: auto 1fr; padding: 14px 20px; }
.dashboard-activity-log .activity-item > div > div { display: grid; grid-template-columns: 1fr auto; gap: 14px; }
.quick-actions-panel { padding-bottom: 12px; }
.quick-action { display: grid; width: calc(100% - 28px); grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; margin: 0 14px 10px; padding: 15px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: #fff; text-align: left; }
.quick-action:hover:not(:disabled) { border-color: #9ac4ef; background: #f7fbff; }
.quick-action:disabled { opacity: .48; cursor: not-allowed; }
.quick-action > span:first-child { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 50%; color: var(--blue-700); background: var(--blue-100); font-size: 20px; }
.quick-action > span:nth-child(2) { display: grid; gap: 4px; }
.quick-action small { color: var(--muted); }
.quick-action b { color: var(--blue-700); font-size: 24px; }

.activity-log { display: grid; }
.activity-item { display: grid; grid-template-columns: auto 1fr; gap: 13px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.activity-item:last-child { border-bottom: 0; }
.activity-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; color: var(--blue-700); background: var(--blue-100); font-weight: 850; }
.activity-icon.success, .activity-icon.consent { color: var(--green-700); background: var(--green-100); }
.activity-icon.security { color: #9b6300; background: var(--amber-100); }
.activity-item > div > div { display: flex; justify-content: space-between; gap: 12px; }
.activity-item time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.activity-item p { margin: 3px 0 0; font-size: 13px; }

.history-flow-status { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center; gap: 18px; margin-bottom: 20px; padding: 18px 24px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.history-flow-status > div { display: grid; grid-template-columns: auto 1fr; gap: 1px 12px; align-items: center; }
.history-flow-status small { color: var(--muted); }
.flow-node { grid-row: 1 / 3; display: grid; width: 40px; height: 40px; place-items: center; border-radius: 50%; color: #fff; background: var(--navy-900); font-weight: 850; }
.flow-node.relay { background: var(--blue-600); }
.flow-node.garmin { background: var(--green-600); }
.flow-link { color: #9caabd; font-size: 24px; }
.timeline-panel { overflow: hidden; }
.timeline-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.timeline-toolbar h2 { margin-bottom: 4px; }
.measurements-count { color: var(--muted); font-size: 12px; font-weight: 700; }
.timeline-controls { display: flex; align-items: flex-end; gap: 12px; }
.timeline-controls > label { min-width: 110px; }
.timeline-controls select { min-height: 38px; }
.history-filters { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: #f4f7fa; }
.history-filter { min-height: 34px; padding: 7px 11px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 800; }
.history-filter.active { color: #fff; background: var(--navy-900); box-shadow: 0 3px 8px rgba(8,34,71,.15); }
.history-timeline { padding: 10px 24px 24px; }
.timeline-day { position: relative; padding: 18px 0 0 142px; }
.timeline-day::before { content: ""; position: absolute; top: 56px; bottom: -18px; left: 105px; width: 2px; background: #d9e4ef; }
.timeline-day:last-child::before { bottom: 16px; }
.timeline-day-heading { position: absolute; top: 24px; left: 0; width: 91px; color: var(--ink); font-size: 13px; font-weight: 850; text-align: right; }
.timeline-entry { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 14px; margin-bottom: 12px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 9px; background: #fff; box-shadow: 0 3px 10px rgba(8,34,71,.035); }
.timeline-entry::before { content: ""; position: absolute; top: 25px; left: -43px; width: 14px; height: 14px; border: 4px solid #fff; border-radius: 50%; background: var(--blue-600); box-shadow: 0 0 0 1px #bfd2e5; }
.timeline-entry.success::before { background: var(--green-600); }
.timeline-entry.warning::before, .timeline-entry.failed::before { background: var(--amber-600); }
.timeline-entry-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 8px; color: var(--blue-700); background: var(--blue-100); font-size: 20px; font-weight: 850; }
.timeline-entry.success .timeline-entry-icon { color: var(--green-700); background: var(--green-100); }
.timeline-entry.warning .timeline-entry-icon, .timeline-entry.failed .timeline-entry-icon { color: #9b6300; background: var(--amber-100); }
.timeline-entry-copy h3 { margin: 0 0 4px; }
.timeline-entry-copy p { margin: 0; font-size: 13px; }
.timeline-entry-copy .timeline-metrics { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.timeline-entry-copy .timeline-metrics span { padding: 4px 7px; border-radius: 5px; color: #34506f; background: #edf3f8; font-size: 11px; font-weight: 700; }
.timeline-entry-meta { display: grid; justify-items: end; gap: 7px; min-width: 84px; }
.timeline-entry time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.timeline-entry .actions { display: flex; gap: 6px; }
.mini-button { min-height: 31px; padding: 6px 9px; border: 0; border-radius: 6px; color: #fff; background: var(--blue-700); font-size: 11px; font-weight: 800; }
.mini-button.secondary { color: var(--ink); border: 1px solid var(--line); background: #fff; }

.account-grid { display: grid; gap: 18px; }
.account-section { overflow: hidden; }
.account-split { display: grid; grid-template-columns: 1fr 1fr; }
.account-split > form { align-content: start; padding: 22px 24px 25px; }
.account-split > form > .button { width: 100%; }
.account-split > form + form { border-left: 1px solid var(--line); }
.preference-checkbox { padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: #fafbfd; }
.provider-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 20px 24px 10px; }
.provider-grid > div { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 9px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #a5afbc; }
.status-dot.ok { background: var(--green-600); }
.status-dot.warning { background: var(--amber-600); }
.disconnect-button { padding: 5px 8px; border: 0; color: var(--red-600); background: transparent; font-size: 11px; font-weight: 750; }
.consent-gate, .provider-actions, .mfa-form { padding: 20px 24px; }
.consent-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.provider-actions { display: grid; gap: 10px; padding-top: 10px; }
.provider-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 13px; padding: 15px; border: 1px solid var(--line); border-radius: 8px; }
.provider-card h3 { margin: 0; }
.provider-logo { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 50%; color: #fff; background: #111; font-weight: 850; }
.provider-logo.garmin { background: var(--blue-700); }
.provider-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 18px; padding: 22px 24px; }
.danger-zone h2 { margin: 0; }
.account-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.support-heading { padding: 26px 28px; border-radius: var(--radius); color: #fff; background: linear-gradient(120deg, var(--navy-900), var(--blue-700)); }
.support-heading .eyebrow, .support-heading p { color: #d9eaff; }
.support-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.support-section-heading, .support-contact-grid { grid-column: 1 / -1; }
.support-grid details { border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.support-grid summary { padding: 17px 18px; font-weight: 800; cursor: pointer; }
.support-grid details p { margin: 0; padding: 0 18px 18px; }
.support-contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 10px; }
.support-contact { display: grid; grid-template-columns: auto 1fr; gap: 13px; padding: 22px; border-radius: var(--radius); color: #fff; background: var(--navy-900); }
.support-contact > span { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 50%; color: var(--navy-900); background: #fff; font-size: 20px; }
.support-contact p { color: #d5e1ee; }
.support-contact .button { grid-column: 1 / -1; background: #fff; color: var(--navy-900); }
.suggestion-contact { background: var(--blue-700); }
.legal-gate { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; padding: 20px 22px; border: 1px solid #e6c478; border-radius: var(--radius); background: #fff8e8; }
.legal-gate p { margin-bottom: 0; }
.app-footer { width: min(100%, 1390px); margin: 34px auto 0; }
.menu-backdrop, .app-menu { display: none; }

.legal-page { min-height: 100vh; background: radial-gradient(circle at 85% 5%, rgba(11,109,215,.09), transparent 28%), var(--canvas); }
.legal-header { border-bottom: 1px solid rgba(255,255,255,.1); background: radial-gradient(circle at 0 100%, #0b3e70, transparent 48%), linear-gradient(110deg, var(--navy-950), #0a315e); box-shadow: 0 10px 30px rgba(6,26,53,.12); }
.legal-header-inner { display: flex; width: min(calc(100% - 44px), 1060px); min-height: 76px; align-items: center; justify-content: space-between; gap: 24px; margin: 0 auto; }
.legal-header .brand { font-size: 23px; }
.legal-back { display: inline-flex; min-height: 38px; align-items: center; gap: 8px; padding: 8px 13px; border: 1px solid rgba(255,255,255,.2); border-radius: 8px; color: #e4eef8; background: rgba(255,255,255,.06); font-size: 13px; font-weight: 780; text-decoration: none; transition: background .15s, border-color .15s, transform .15s; }
.legal-back:hover { border-color: rgba(255,255,255,.38); color: #fff; background: rgba(255,255,255,.12); transform: translateY(-1px); }
.legal-document { width: min(calc(100% - 44px), 1060px); margin: 0 auto; padding: 44px 0 30px; }
.legal-hero { margin-bottom: 24px; }
.legal-hero .eyebrow { margin-bottom: 9px; }
.legal-hero h1 { max-width: 850px; margin: 0; font-size: clamp(38px, 5vw, 54px); }
.legal-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-bottom: 16px; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,.82); box-shadow: 0 5px 20px rgba(8,34,71,.045); }
.legal-nav-link { display: flex; min-height: 43px; align-items: center; justify-content: center; padding: 9px 14px; border-radius: 8px; color: var(--muted); font-size: 13px; font-weight: 800; text-align: center; text-decoration: none; transition: color .15s, background .15s, box-shadow .15s; }
.legal-nav-link:hover { color: var(--blue-700); background: var(--blue-100); }
.legal-nav-link.active { color: #fff; background: linear-gradient(100deg, var(--navy-900), var(--blue-700)); box-shadow: 0 7px 18px rgba(7,93,185,.18); }
.legal-content { padding: clamp(28px, 5vw, 54px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.legal-content .legal-updated { display: inline-flex; margin: 0 0 28px; padding: 7px 11px; border-radius: 999px; color: var(--blue-700); background: var(--blue-100); font-size: 12px; font-weight: 780; }
.legal-content h2 { margin: 0 0 11px; color: var(--ink); font-size: 21px; scroll-margin-top: 20px; }
.legal-content h2:not(:first-of-type) { margin-top: 34px; padding-top: 30px; border-top: 1px solid var(--line); }
.legal-content p { max-width: 82ch; margin-bottom: 16px; color: #41536b; font-size: 15px; line-height: 1.72; }
.legal-content h2 + p { margin-top: 0; }
.legal-content ul { display: grid; max-width: 82ch; gap: 9px; margin: 0 0 20px; padding-left: 21px; color: #41536b; line-height: 1.65; }
.legal-content li::marker { color: var(--blue-600); }
.legal-content a { font-weight: 700; }
.legal-footer { display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 24px 4px 0; color: #718096; font-size: 12px; }
.legal-footer a { color: #718096; text-decoration: none; }
.legal-footer a:hover { color: var(--blue-700); }
.legal-back:focus-visible, .legal-nav-link:focus-visible { outline: 3px solid rgba(11,109,215,.26); outline-offset: 2px; }

@media (max-width: 1180px) {
  .dashboard-operational-grid { grid-template-columns: 1fr; }
  .quick-actions-panel { display: grid; grid-template-columns: repeat(3, 1fr); padding: 0 12px 12px; }
  .quick-actions-panel .panel-heading { grid-column: 1 / -1; margin: 0 -12px 2px; }
  .quick-action { width: auto; margin: 0; }
  .relay-health { grid-template-columns: auto 1fr; }
  .dashboard-provider-status { grid-column: 1 / -1; }
}

@media (max-width: 920px) {
  .desktop-sidebar { width: 210px; }
  .app-header { left: 210px; }
  .app-main { margin-left: 210px; }
  .sync-choice-grid, .account-split, .provider-fields { grid-template-columns: 1fr; }
  .account-split > form + form { border-top: 1px solid var(--line); border-left: 0; }
  .active-plan-controls, .danger-zone { align-items: stretch; flex-direction: column; }
  .active-plan-summary { align-items: flex-start; }
  .active-plan-controls > .active-plan-actions { width: 100%; flex: 0 0 auto; }
  .timeline-toolbar { align-items: stretch; flex-direction: column; }
  .timeline-controls { align-items: stretch; flex-direction: column; }
}

@media (max-width: 760px) {
  .legal-header-inner, .legal-document { width: min(calc(100% - 28px), 1060px); }
  .legal-header-inner { min-height: 66px; }
  .legal-header .brand { font-size: 20px; }
  .legal-back { padding-inline: 10px; }
  .legal-document { padding-top: 30px; }
  .legal-hero { margin-bottom: 18px; }
  .legal-hero h1 { font-size: 36px; }
  .legal-content { padding: 26px 22px; }
  .legal-content h2:not(:first-of-type) { margin-top: 28px; padding-top: 25px; }
  .desktop-sidebar { display: none; }
  .desktop-nav { display: none; }
  .app-header { left: 0; height: 62px; padding: 0 14px; }
  .app-header > .icon-button { display: grid; }
  .mobile-brand { display: inline-flex; margin-left: 10px; font-size: 19px; }
  .mobile-brand .brand-mark { width: 24px; height: 24px; }
  .header-context { display: none; }
  .header-account { gap: 8px; }
  .header-account .language-picker select { min-width: 58px; height: 36px; }
  .avatar, .header-account-trigger { width: 36px; height: 36px; }
  .app-main { margin-left: 0; padding: 84px 14px 22px; }
  .app-message { top: 70px; right: 14px; left: 14px; max-width: none; }
  .app-menu { position: fixed; z-index: 80; inset: 0 auto 0 0; display: flex; width: min(86vw, 330px); flex-direction: column; padding: 18px; color: #fff; background: var(--navy-950); transform: translateX(-105%); transition: transform .2s ease; }
  .app-menu.open { transform: translateX(0); }
  .app-menu nav { display: grid; gap: 6px; }
  .app-menu .menu-link { color: #d8e3ef; }
  .app-menu .menu-link.active { color: #fff; background: var(--blue-700); }
  .app-menu .logout-button { margin-top: auto; }
  .menu-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; font-size: 20px; font-weight: 850; }
  .close-button { width: 38px; height: 38px; border: 0; border-radius: 8px; color: #fff; background: rgba(255,255,255,.1); font-size: 24px; }
  .menu-backdrop { position: fixed; z-index: 75; inset: 0; display: block; background: rgba(4,16,34,.58); backdrop-filter: blur(2px); }
  body.menu-open { overflow: hidden; }
  .page-heading { align-items: flex-start; }
  .page-heading h1 { font-size: 32px; }
  .relay-health { grid-template-columns: auto 1fr; padding: 18px; }
  .dashboard-provider-status { display: grid; grid-template-columns: 1fr 1fr; }
  .dashboard-provider { min-width: 0; }
  .onboarding-heading, .onboarding-next, .active-plan-controls, .danger-zone, .legal-gate { align-items: stretch; flex-direction: column; }
  #active-plan-status { justify-self: start; }
  .active-plan-footer { display: grid; }
  .active-plan-details summary { padding-right: 18px; }
  .active-plan-detail-grid { grid-template-columns: 1fr; }
  .active-plan-detail-grid > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .active-plan-detail-grid > div:last-child { border-bottom: 0; }
  .active-plan-footer > #active-plan-billing { position: static; justify-self: start; margin: 0 18px 12px; }
  .onboarding-steps { grid-template-columns: 1fr; }
  .sync-choice-grid { padding: 14px; }
  .sync-status-grid { grid-template-columns: 1fr; }
  .sync-status-grid > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .sync-status-grid > div:last-child { border-bottom: 0; }
  .quick-actions-panel { display: block; padding: 0 0 4px; }
  .quick-actions-panel .panel-heading { margin: 0; }
  .quick-action { width: calc(100% - 24px); margin: 0 12px 10px; }
  .history-flow-status { grid-template-columns: 1fr; gap: 10px; }
  .history-flow-status > div { grid-template-columns: auto 1fr; }
  .flow-link { margin-left: 18px; transform: rotate(90deg); transform-origin: left center; }
  .timeline-toolbar { padding: 18px; }
  .history-filters { display: grid; grid-template-columns: 1fr 1fr; }
  .history-timeline { padding: 4px 14px 18px; }
  .timeline-day { padding: 54px 0 0 30px; }
  .timeline-day::before { top: 78px; left: 7px; }
  .timeline-day-heading { top: 22px; left: 0; width: auto; text-align: left; }
  .timeline-entry { grid-template-columns: auto 1fr; padding: 14px; }
  .timeline-entry::before { top: 22px; left: -30px; }
  .timeline-entry-meta { grid-column: 2; justify-items: start; }
  .account-split, .provider-grid, .support-grid, .support-contact-grid { grid-template-columns: 1fr; }
  .support-section-heading, .support-contact-grid { grid-column: 1; }
  .provider-grid { padding: 16px; }
  .provider-grid > div { grid-template-columns: auto 1fr auto; }
  .disconnect-button { grid-column: 2 / -1; justify-self: start; }
  .consent-row { align-items: stretch; flex-direction: column; }
  .site-footer { flex-direction: column; }
  .app-footer { margin-top: 28px; }
}

@media (max-width: 560px) {
  .legal-back { width: 38px; overflow: hidden; white-space: nowrap; }
  .legal-back span { flex: 0 0 auto; font-size: 18px; }
  .legal-nav { grid-template-columns: 1fr; }
  .legal-nav-link { justify-content: flex-start; padding-inline: 14px; }
  .legal-footer { align-items: flex-start; flex-direction: column; gap: 8px; }
  .auth-view { display: block; background: #fff; }
  .auth-story { min-height: 310px; padding: 26px 22px; }
  .auth-pitch { margin: 50px 0 20px; }
  .auth-pitch h1 { font-size: 45px; }
  .trust-list { display: none; }
  .auth-panel { min-height: auto; padding: 34px 22px 22px; }
  .auth-footer { margin-top: 50px; }
  .relay-health { grid-template-columns: 1fr; }
  .relay-health-icon { width: 38px; height: 38px; }
  .dashboard-provider-status { grid-template-columns: 1fr; }
  .panel-heading { padding: 18px; }
  .automatic-plan-form { grid-template-columns: 1fr; }
  .active-plan-actions .button { padding-inline: 6px; font-size: 12px; }
  .site-footer nav { display: grid; }
}

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