:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", ui-sans-serif, system-ui, -apple-system, sans-serif;
  color: #172422;
  background: #f3f6f4;
  --ink: #172422;
  --muted: #647570;
  --surface: #ffffff;
  --surface-soft: #f5f8f6;
  --surface-green: #e9f4ef;
  --line: #d9e2de;
  --line-strong: #bacac4;
  --brand: #183f39;
  --brand-hover: #24564e;
  --accent: #58d3a5;
  --accent-soft: #dff7ed;
  --blue: #4f8bd8;
  --blue-soft: #e5effc;
  --amber: #b77517;
  --amber-soft: #fff1d8;
  --danger: #a63b3b;
  --danger-soft: #fff0ef;
  --shadow: 0 16px 50px rgba(27, 57, 50, .09);
  --radius: 1.1rem;
  --sidebar: 17rem;
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body { min-width: 19rem; min-height: 100vh; margin: 0; background: var(--surface-soft); line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button { min-height: 2.75rem; padding: .7rem 1rem; color: var(--brand); background: var(--surface); border: 1px solid var(--line-strong); border-radius: .75rem; font-weight: 700; }
button:hover:not(:disabled) { border-color: var(--brand); background: var(--surface-green); }
button:disabled { cursor: not-allowed; opacity: .5; }
button.primary { color: #fff; background: var(--brand); border-color: var(--brand); }
button.primary:hover:not(:disabled) { color: #fff; background: var(--brand-hover); }
button.secondary { background: var(--surface); }
button.danger { color: var(--danger); border-color: #e4b4b1; background: var(--danger-soft); }
button.ghost, button.text-button { min-height: auto; padding: .35rem .25rem; border: 0; background: transparent; }
button.text-button { color: var(--brand); }
button.full { width: 100%; }
input, select, textarea { width: 100%; min-height: 2.85rem; padding: .72rem .8rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: .72rem; }
textarea { min-height: 6rem; resize: vertical; }
input::placeholder, textarea::placeholder { color: #86938f; }
label { font-weight: 650; }
form { display: grid; gap: .68rem; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: .35rem; font-size: clamp(1.8rem, 3vw, 2.45rem); line-height: 1.13; letter-spacing: -.035em; }
h2 { margin-bottom: .45rem; font-size: clamp(1.2rem, 2vw, 1.5rem); line-height: 1.25; }
h3 { margin-bottom: .35rem; font-size: 1rem; }
p { margin-bottom: .75rem; }
a { color: inherit; }
:focus-visible { outline: .2rem solid #1b8f6b; outline-offset: .16rem; }
[hidden] { display: none !important; }

.skip-link { position: fixed; z-index: 1000; top: .5rem; left: .5rem; padding: .6rem .8rem; color: #fff; background: var(--brand); border-radius: .5rem; transform: translateY(-150%); }
.skip-link:focus { transform: none; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.muted, .field-hint { color: var(--muted); }
.field-hint { margin: -.25rem 0 .25rem; font-size: .83rem; }
.eyebrow { margin-bottom: .4rem; color: #25775f; font-size: .72rem; font-weight: 800; letter-spacing: .13em; }
.brand { display: inline-flex; align-items: center; gap: .65rem; color: var(--brand); text-decoration: none; font-size: 1.3rem; font-weight: 850; letter-spacing: -.025em; }
.brand img { display: block; border-radius: 12px; }

.auth-shell { min-height: 100vh; background: radial-gradient(circle at 12% 18%, #dff5ec 0, transparent 31rem), linear-gradient(150deg, #f9fbfa 0%, #eef5f1 100%); }
.auth-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; max-width: 76rem; margin: auto; padding: 1.2rem clamp(1rem, 4vw, 3rem); }
.header-actions, .topbar-actions, .button-row, .modal-actions, .section-heading, .modal-heading { display: flex; align-items: center; gap: .75rem; }
.header-actions, .topbar-actions { justify-content: flex-end; }
.locale-control select { width: auto; min-height: 2.45rem; padding: .45rem 2rem .45rem .65rem; background: rgba(255,255,255,.8); }
.auth-main { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(22rem, .8fr); align-items: center; gap: clamp(2rem, 8vw, 7rem); max-width: 72rem; min-height: calc(100vh - 6rem); margin: auto; padding: 2rem clamp(1rem, 4vw, 3rem) 5rem; }
.auth-intro h1 { max-width: 13ch; font-size: clamp(2.7rem, 6vw, 5rem); }
.auth-intro > p:not(.eyebrow) { max-width: 35rem; color: #485a55; font-size: 1.12rem; }
.trust-list { display: grid; gap: .65rem; margin: 1.8rem 0 0; padding: 0; list-style: none; }
.trust-list li { display: flex; gap: .65rem; align-items: center; font-weight: 650; }
.trust-list li::before { display: grid; place-items: center; width: 1.4rem; height: 1.4rem; content: "✓"; color: var(--brand); background: var(--accent); border-radius: 999px; font-size: .8rem; font-weight: 900; }
.auth-card { width: 100%; max-width: 30rem; justify-self: end; padding: 1.5rem; background: rgba(255,255,255,.94); border: 1px solid rgba(174,194,186,.75); border-radius: 1.35rem; box-shadow: var(--shadow); backdrop-filter: blur(8px); }
.auth-tabs, .segmented { display: flex; gap: .25rem; padding: .25rem; margin-bottom: 1.4rem; background: #edf2ef; border-radius: .8rem; }
.tab-button, .segmented button { flex: 1; min-height: 2.45rem; padding: .45rem .55rem; border: 0; background: transparent; font-size: .9rem; }
.tab-button.is-active, .segmented button.is-active { color: var(--ink); background: var(--surface); box-shadow: 0 2px 10px rgba(33,60,54,.08); }
.auth-view > h2 { font-size: 1.65rem; }
.recommended { margin-left: .55rem; padding: .18rem .42rem; color: var(--brand); background: var(--accent); border-radius: 999px; font-size: .7rem; }
.divider { display: flex; align-items: center; gap: .7rem; margin: 1rem 0; color: var(--muted); font-size: .8rem; }
.divider::before, .divider::after { flex: 1; height: 1px; content: ""; background: var(--line); }
.auth-method { margin-top: .7rem; padding: .75rem .85rem; border: 1px solid var(--line); border-radius: .85rem; }
.auth-method summary { cursor: pointer; font-weight: 750; }
.auth-method[open] summary { margin-bottom: .85rem; }
.support-note, .warning-note { padding: .7rem .8rem; margin: .7rem 0; border-radius: .7rem; font-size: .86rem; }
.support-note { color: #315c50; background: var(--surface-green); }
.warning-note { color: #704d15; background: var(--amber-soft); border: 1px solid #ead3a9; }
.check-row { display: flex; align-items: flex-start; gap: .65rem; padding: .25rem 0; font-size: .9rem; font-weight: 500; }
.check-row input { flex: 0 0 auto; width: 1.15rem; min-height: 1.15rem; margin-top: .15rem; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; display: flex; flex-direction: column; width: var(--sidebar); padding: 1.4rem 1rem; color: #edf7f3; background: #12342f; border-right: 1px solid #244942; }
.sidebar-brand { padding: .2rem .65rem 1.65rem; color: #fff; }
.primary-nav { display: grid; gap: .35rem; }
.nav-item { position: relative; display: flex; align-items: center; gap: .75rem; width: 100%; color: inherit; background: transparent; border-color: transparent; text-align: left; }
.sidebar .nav-item { color: #c8d9d4; }
.sidebar .nav-item:hover:not(:disabled), .sidebar .nav-item.is-active { color: #fff; background: #245047; border-color: #315f56; }
.nav-icon { display: grid; place-items: center; width: 1.7rem; height: 1.7rem; font-size: 1.2rem; }
.count-badge { min-width: 1.25rem; margin-left: auto; padding: .1rem .35rem; color: var(--brand); background: var(--accent); border-radius: 999px; text-align: center; font-size: .72rem; }
.sidebar-footer { margin-top: auto; padding: 1rem .6rem .4rem; border-top: 1px solid #31534d; }
.sidebar-footer .text-button { color: #d3e6e0; }
.privacy-line { color: #9fd5c3; font-size: .76rem; }
.privacy-line > span:first-child { color: var(--accent); }
.mobile-header, .bottom-nav { display: none; }
.app-main { min-height: 100vh; margin-left: var(--sidebar); padding: 1.7rem clamp(1rem, 4vw, 3rem) 4rem; }
.page-topbar { display: flex; align-items: center; justify-content: space-between; max-width: 76rem; margin: 0 auto 1.6rem; }
.page-topbar h1 { margin: 0; }
.connection-pill, .success-pill { display: inline-flex; align-items: center; width: max-content; padding: .35rem .6rem; color: #315c50; background: var(--surface-green); border: 1px solid #c7dfd6; border-radius: 999px; font-size: .76rem; font-weight: 750; }
.connection-pill::before { width: .45rem; height: .45rem; margin-right: .4rem; content: ""; background: #2ba779; border-radius: 999px; }
.connection-pill[data-state="offline"] { color: #79551e; background: var(--amber-soft); border-color: #ead3a9; }
.connection-pill[data-state="offline"]::before { background: var(--amber); }
.icon-button, .avatar-button, .close-button { display: grid; place-items: center; flex: 0 0 auto; padding: 0; }
.icon-button { width: 2.65rem; }
.avatar-button { width: 2.75rem; color: #fff; background: var(--brand); border-color: var(--brand); border-radius: 999px; font-size: .78rem; }
.app-view { max-width: 76rem; margin: auto; }
.hero-card { display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding: clamp(1.3rem, 3vw, 2.2rem); color: #f2fbf7; background: linear-gradient(120deg, #183f39, #285d52); border-radius: 1.25rem; box-shadow: var(--shadow); }
.hero-card h2 { font-size: clamp(1.5rem, 3vw, 2.15rem); }
.hero-card p:not(.eyebrow) { max-width: 42rem; margin-bottom: 0; color: #d0e4de; }
.hero-card .eyebrow { color: #83e0bd; }
.hero-card button { flex: 0 0 auto; color: var(--brand); background: var(--accent); border-color: var(--accent); }
.compact-hero { align-items: flex-end; margin-bottom: 1rem; }
.compact-hero .button-row { flex: 0 0 auto; }
.compact-hero .button-row button:not(.primary) { color: #edf7f3; background: transparent; border-color: #76968e; }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 1rem 0; }
.summary-card { display: flex; align-items: center; gap: 1rem; min-height: 6.2rem; padding: 1rem; color: var(--ink); background: var(--surface); border-color: var(--line); box-shadow: 0 8px 25px rgba(31,61,54,.05); text-align: left; }
.summary-icon { display: grid; place-items: center; width: 3.1rem; height: 3.1rem; border-radius: 1rem; font-size: 1.45rem; }
.summary-icon.accent { background: var(--accent-soft); }
.summary-icon.blue { background: var(--blue-soft); }
.summary-icon.amber { background: var(--amber-soft); }
.summary-card strong { display: block; font-size: 1.6rem; line-height: 1; }
.summary-card small { display: block; margin-top: .35rem; color: var(--muted); font-weight: 500; }
.location-card { display: grid; grid-template-columns: minmax(12rem, .65fr) minmax(20rem, 1.35fr); overflow: hidden; margin: 1rem 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 25px rgba(31,61,54,.05); }
.location-map { position: relative; display: grid; place-items: center; min-height: 18rem; background-color: #deebe5; background-image: linear-gradient(32deg, transparent 46%, rgba(55,110,93,.18) 47%, rgba(55,110,93,.18) 50%, transparent 51%), linear-gradient(-35deg, transparent 46%, rgba(55,110,93,.12) 47%, rgba(55,110,93,.12) 50%, transparent 51%); background-size: 5rem 4rem; }
.location-map::after { position: absolute; inset: 12% 18%; content: ""; border: 2px dashed rgba(24,63,57,.28); border-radius: 45% 55% 60% 40%; transform: rotate(-8deg); }
.location-map span { z-index: 1; display: grid; place-items: center; width: 4rem; height: 4rem; color: #fff; background: var(--brand); border: .65rem solid rgba(88,211,165,.5); border-radius: 999px; font-size: 1.5rem; box-shadow: 0 8px 20px rgba(24,63,57,.22); }
.location-content { padding: clamp(1.3rem, 3vw, 2.2rem); }
.location-options { display: grid; grid-template-columns: minmax(8rem, auto) minmax(10rem, 1fr); gap: .45rem .8rem; align-items: center; margin: .8rem 0; }
.location-options label, .location-options input, .location-options select { margin: 0; }
.active-access { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem .8rem; margin: .8rem 0; color: #235845; background: var(--accent-soft); border-radius: .7rem; font-size: .86rem; }
.content-section { margin-top: 1.8rem; }
.section-heading { justify-content: space-between; margin-bottom: .8rem; }
.section-heading h2 { margin: 0; }
.action-heading { align-items: flex-end; }
.action-heading > p { max-width: 48rem; margin-bottom: 0; }
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.data-card, .organization-card, .settings-card, .list-card { min-width: 0; padding: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 25px rgba(31,61,54,.04); }
.data-card { display: grid; gap: .7rem; }
.data-card-header, .list-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: .8rem; }
.type-icon { display: grid; place-items: center; flex: 0 0 auto; width: 2.65rem; height: 2.65rem; color: var(--brand); background: var(--accent-soft); border-radius: .8rem; font-size: 1.15rem; }
.card-title { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.card-title strong, .data-preview { overflow-wrap: anywhere; }
.card-title small { display: block; color: var(--muted); font-weight: 500; }
.data-preview { margin: 0; color: #394c47; }
.share-pills, .chip-row { display: flex; flex-wrap: wrap; gap: .45rem; }
.share-pill, .chip { padding: .3rem .55rem; color: #315c50; background: var(--surface-green); border: 1px solid #c7dfd6; border-radius: 999px; font-size: .75rem; }
.share-pill button { min-height: 0; margin-left: .25rem; padding: 0 .15rem; }
button.chip { min-height: 2.2rem; }
button.chip.is-active { color: #fff; background: var(--brand); border-color: var(--brand); }
.card-actions { display: flex; flex-wrap: wrap; gap: .45rem; padding-top: .7rem; border-top: 1px solid var(--line); }
.card-actions button { min-height: 2.25rem; padding: .4rem .65rem; font-size: .8rem; }
.list-stack { display: grid; gap: .75rem; }
.list-stack.compact { gap: .5rem; }
.list-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.list-card-main { display: flex; align-items: center; gap: .8rem; min-width: 0; }
.list-card-main > div { min-width: 0; }
.list-card p { margin: .2rem 0 0; }
.badge { display: inline-flex; width: max-content; padding: .25rem .5rem; color: #315c50; background: var(--surface-green); border-radius: 999px; font-size: .72rem; font-weight: 750; }
.badge.warning { color: #79551e; background: var(--amber-soft); }
.badge.danger { color: var(--danger); background: var(--danger-soft); }
.segmented { width: min(100%, 30rem); }
.coordination-tabs { width: min(100%, 38rem); }
.detail-panel { padding: 1.1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 25px rgba(31,61,54,.04); }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem .8rem; }
.check-grid .check-row { min-width: 0; }
fieldset { min-width: 0; padding: .8rem; border: 1px solid var(--line); border-radius: .75rem; }
legend { padding: 0 .35rem; font-weight: 700; }
.search-bar, .inline-search { display: flex; align-items: center; gap: .55rem; }
.search-bar { padding: .55rem; margin-bottom: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: .9rem; }
.search-bar input, .inline-search input { flex: 1; }
.search-bar input { border: 0; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.settings-card { padding: 1.2rem; }
.profile-details { margin: 1rem 0 0; }
.profile-details > div { display: grid; grid-template-columns: 7rem 1fr; gap: 1rem; padding: .65rem 0; border-top: 1px solid var(--line); }
.profile-details dt { color: var(--muted); }
.profile-details dd { margin: 0; overflow-wrap: anywhere; font-weight: 700; }
.secret-result { margin-top: .8rem; padding: .8rem; background: #f7faf8; border: 1px dashed var(--line-strong); border-radius: .7rem; font-family: ui-monospace, monospace; overflow-wrap: anywhere; }
.secret-result code { display: block; padding: .25rem; }
.premium-note { margin-top: 1rem; padding: .8rem; color: #604a21; background: var(--amber-soft); border-radius: .75rem; }
.premium-note p { margin: .25rem 0 0; font-size: .85rem; }
.empty-state, .inline-empty { display: grid; justify-items: center; padding: 3rem 1rem; color: var(--muted); text-align: center; }
.inline-empty { padding: 1.4rem; background: rgba(255,255,255,.6); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.inline-empty p { margin-bottom: 0; }
.empty-icon { display: grid; place-items: center; width: 4rem; height: 4rem; margin-bottom: .8rem; color: var(--brand); background: var(--accent-soft); border-radius: 1.2rem; font-size: 1.6rem; }

.modal { width: min(100% - 2rem, 36rem); max-height: calc(100vh - 2rem); padding: 0; overflow: auto; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 1.2rem; box-shadow: 0 25px 80px rgba(17,45,39,.25); }
.modal::backdrop { background: rgba(11,31,27,.6); backdrop-filter: blur(3px); }
.modal > form { padding: 1.3rem; }
.small-modal { max-width: 29rem; }
.modal-heading { justify-content: space-between; margin-bottom: .6rem; }
.modal-heading h2 { margin: 0; }
.close-button { width: 2.5rem; height: 2.5rem; min-height: 0; color: var(--muted); background: transparent; border: 0; font-size: 1.6rem; }
.modal-actions { justify-content: flex-end; padding-top: 1rem; margin-top: .4rem; border-top: 1px solid var(--line); }
.dynamic-fields { display: grid; gap: .68rem; }
.choice-list { display: grid; gap: .45rem; max-height: 13rem; overflow: auto; }
.choice-button { display: flex; align-items: center; gap: .6rem; width: 100%; text-align: left; }
.choice-button.is-selected { background: var(--accent-soft); border-color: #66b99a; }
.toast { position: fixed; z-index: 100; right: 1rem; bottom: 1rem; width: min(26rem, calc(100% - 2rem)); padding: .8rem 1rem; color: #fff; background: var(--brand); border-radius: .8rem; box-shadow: var(--shadow); }
.toast:empty { display: none; }
.toast[data-error="true"] { background: #7d2d2d; }

@media (max-width: 900px) {
  .auth-main { grid-template-columns: 1fr; max-width: 36rem; }
  .auth-intro { padding-top: 2rem; }
  .auth-intro h1 { max-width: 15ch; font-size: clamp(2.5rem, 10vw, 4rem); }
  .auth-card { justify-self: stretch; max-width: none; }
  .sidebar { display: none; }
  .mobile-header { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; justify-content: space-between; padding: .75rem 1rem; background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
  .app-main { margin-left: 0; padding: 1rem 1rem 6rem; }
  .page-topbar { margin-top: .5rem; }
  .bottom-nav { position: fixed; z-index: 20; inset: auto 0 0; display: grid; grid-template-columns: repeat(6, 1fr); padding: .4rem max(.3rem, env(safe-area-inset-right)) calc(.4rem + env(safe-area-inset-bottom)) max(.3rem, env(safe-area-inset-left)); background: rgba(255,255,255,.97); border-top: 1px solid var(--line); box-shadow: 0 -8px 28px rgba(31,61,54,.08); backdrop-filter: blur(10px); }
  .bottom-nav .nav-item { display: grid; justify-items: center; gap: .15rem; min-height: 3.4rem; padding: .35rem .1rem; color: var(--muted); border: 0; font-size: 1.1rem; }
  .bottom-nav .nav-item.is-active { color: var(--brand); background: var(--accent-soft); }
  .bottom-nav small { font-size: .66rem; line-height: 1.1; }
  .desktop-only { display: none; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 650px) {
  .auth-header { align-items: flex-start; }
  .auth-header .connection-pill { display: none; }
  .auth-main { padding-top: 0; }
  .auth-intro > p:not(.eyebrow), .trust-list { font-size: .95rem; }
  .auth-card { padding: 1rem; }
  .page-topbar h1 { font-size: 1.75rem; }
  .connection-pill { font-size: 0; }
  .connection-pill::before { margin: 0; }
  .hero-card { align-items: flex-start; flex-direction: column; }
  .hero-card button { width: 100%; }
  .summary-grid { grid-template-columns: 1fr; gap: .65rem; }
  .summary-card { min-height: 4.8rem; }
  .location-card { grid-template-columns: 1fr; }
  .location-map { min-height: 10rem; }
  .location-options { grid-template-columns: 1fr; }
  .compact-hero .button-row { width: 100%; }
  .check-grid { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: 1fr; }
  .action-heading { align-items: stretch; flex-direction: column; }
  .action-heading > button { width: 100%; }
  .button-row { flex-wrap: wrap; }
  .button-row > button { flex: 1 1 10rem; }
  .list-card { align-items: stretch; flex-direction: column; }
  .list-card > button { width: 100%; }
  .modal { width: calc(100% - 1rem); max-height: calc(100vh - 1rem); }
  .profile-details > div { grid-template-columns: 1fr; gap: .2rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

@media (forced-colors: active) {
  button, input, select, textarea, .data-card, .list-card, .settings-card { border: 1px solid CanvasText; }
}
