/* =====================================================================
   Aventra — shell layout + shared components
   Only tokens from tokens.css. Module files (globe/panel/cards/shell/
   safetymap/pages) add their own classes on top of these.
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: auto; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font-ui); font-size: var(--fs-md); line-height: 1.5; color: var(--text);
  background: var(--bg-2);
  background-image: linear-gradient(160deg, var(--bg-1) 0%, var(--bg-2) 38%, var(--bg-3) 78%, var(--bg-4) 120%);
  background-attachment: fixed; min-height: 100vh; overflow-x: hidden;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  transition: color var(--dur-slow) var(--ease);
}
html.modal-open body { overflow: hidden; }
::selection { background: var(--selection); }
* { scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 500; color: var(--heading); letter-spacing: 0.005em; margin: 0; line-height: 1.15; }
h1 { font-size: var(--fs-3xl); } h2 { font-size: var(--fs-2xl); } h3 { font-size: var(--fs-xl); } h4 { font-size: var(--fs-lg); }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[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; }
.ico { display: inline-block; vertical-align: middle; flex: none; }
.muted { color: var(--text-2); } .faint { color: var(--text-3); } .small { font-size: var(--fs-sm); } .xs { font-size: var(--fs-xs); }
.serif { font-family: var(--font-display); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; } .truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; align-items: center; gap: 10px; } .row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 10px; } .grow { flex: 1 1 auto; min-width: 0; } .wrap { flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mb-12 { margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gutter); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gutter); }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gutter); }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--gutter); }

/* ---------------------------------------------------------- glass */
.glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  border: 1px solid var(--glass-rim);
  box-shadow: var(--shadow-card);
  border-radius: var(--radius-lg);
  transition: background var(--dur-slow) var(--ease), border-color var(--dur-slow) var(--ease), box-shadow var(--dur) var(--ease);
}
.glass-strong { background: var(--glass-bg-strong); }
.glass-weak { background: var(--glass-bg-weak); }
.glass-inset { background: var(--surface-2); border: 1px solid var(--glass-rim-2); border-radius: var(--radius-md); }
.card { position: relative; padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-title { font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 500; color: var(--heading); margin: 0; }
.card-sub { color: var(--text-2); font-size: var(--fs-sm); }
.card-link { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-sm); color: var(--text-2); }
.card-link:hover { color: var(--accent); text-decoration: none; }
.card-body { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card.interactive { cursor: pointer; transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.card.interactive:hover { transform: translateY(-3px); box-shadow: var(--shadow-pop); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 6px 0 14px; }
.section-title h2 { font-size: var(--fs-2xl); }
.section-title .sub { color: var(--text-2); font-size: var(--fs-sm); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: var(--fs-3xl); }
.page-head .lede { color: var(--text-2); max-width: 62ch; margin-top: 6px; }
.eyebrow { font-size: var(--fs-xs); letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }

/* --------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: var(--radius-pill);
  font-weight: 600; font-size: var(--fs-sm); line-height: 1; white-space: nowrap; border: 1px solid var(--glass-rim-2);
  background: var(--glass-bg-strong); color: var(--text); transition: transform var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), color var(--dur-fast);
  box-shadow: 0 1px 0 rgba(255,255,255,0.35) inset;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-soft); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); border-color: transparent; box-shadow: 0 8px 20px -6px var(--accent); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); box-shadow: none; }
.btn-outline { background: transparent; border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--risk-red); color: #fff; border-color: transparent; }
.btn-sm { padding: 7px 12px; font-size: var(--fs-xs); }
.btn-lg { padding: 14px 22px; font-size: var(--fs-md); }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; color: var(--text-2);
  background: var(--glass-bg-strong); border: 1px solid var(--glass-rim-2); transition: background var(--dur-fast), color var(--dur-fast), transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast);
  position: relative; flex: none;
}
.icon-btn:hover { color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-soft); }
.icon-btn.sm { width: 32px; height: 32px; } .icon-btn.lg { width: 48px; height: 48px; }
.icon-btn.plain { background: transparent; border-color: transparent; }
.icon-btn.active, .icon-btn[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
.icon-btn .badge { position: absolute; top: 6px; right: 6px; min-width: 9px; height: 9px; border-radius: 6px; background: var(--risk-red); border: 2px solid var(--surface); }
.fav-btn { color: var(--text-3); } .fav-btn.on { color: var(--risk-red); }
.fav-btn .ico { transition: transform var(--dur-fast) var(--ease-spring); } .fav-btn:active .ico { transform: scale(1.3); }

/* ----------------------------------------------------------- pills */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: var(--radius-pill); font-size: var(--fs-xs); font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap; line-height: 1.2; }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.pill.solid { background: var(--accent); color: var(--accent-ink); }
.pill.glass { background: var(--glass-bg-strong); border: 1px solid var(--glass-rim-2); box-shadow: none; border-radius: var(--radius-pill); }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.live .dot { background: var(--risk-green); box-shadow: 0 0 0 0 var(--risk-green); animation: pulse 1.8s var(--ease) infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(52,194,122,0.6); } 70% { box-shadow: 0 0 0 8px rgba(52,194,122,0); } 100% { box-shadow: 0 0 0 0 rgba(52,194,122,0); } }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius-pill); background: var(--glass-bg-strong); border: 1px solid var(--glass-rim-2); font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); transition: all var(--dur-fast) var(--ease); }
.chip:hover { color: var(--text); transform: translateY(-1px); }
.chip.on, .chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* Risk tones */
.tone-green { --tone: var(--risk-green); --tone-soft: var(--risk-green-soft); --tone-ink: var(--risk-green-ink); }
.tone-yellow { --tone: var(--risk-yellow); --tone-soft: var(--risk-yellow-soft); --tone-ink: var(--risk-yellow-ink); }
.tone-orange { --tone: var(--risk-orange); --tone-soft: var(--risk-orange-soft); --tone-ink: var(--risk-orange-ink); }
.tone-red { --tone: var(--risk-red); --tone-soft: var(--risk-red-soft); --tone-ink: var(--risk-red-ink); }
.tone-none { --tone: var(--text-3); --tone-soft: var(--surface-3); --tone-ink: var(--text-2); }
.risk-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--radius-pill); background: var(--tone-soft); color: var(--tone-ink); font-size: var(--fs-xs); font-weight: 700; }
.risk-pill::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--tone); }
.risk-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--tone); box-shadow: 0 0 0 3px var(--tone-soft); flex: none; }
.level-Low, .level-low { color: var(--risk-green-ink); } .level-Moderate, .level-moderate { color: var(--risk-yellow-ink); } .level-Elevated, .level-elevated { color: var(--risk-orange-ink); } .level-High, .level-high { color: var(--risk-red-ink); }

/* ------------------------------------------------------------ tabs */
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding: 4px; border-radius: var(--radius-pill); background: var(--surface-3); }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; padding: 8px 14px; border-radius: var(--radius-pill); font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); white-space: nowrap; transition: background var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-fast); }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"], .tab.on { background: var(--glass-bg-strong); color: var(--heading); box-shadow: var(--shadow-soft); }
.tabs.underline { background: none; padding: 0; border-bottom: 1px solid var(--line); border-radius: 0; gap: 18px; }
.tabs.underline .tab { padding: 10px 2px; border-radius: 0; box-shadow: none; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs.underline .tab[aria-selected="true"] { border-bottom-color: var(--accent); color: var(--heading); }
.tab-panel[hidden] { display: none; }

/* ----------------------------------------------------------- forms */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .label { font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-3); }
.input, .select, .textarea {
  width: 100%; padding: 11px 14px; border-radius: var(--radius-sm); border: 1px solid var(--glass-rim-2); background: var(--glass-bg-strong); color: var(--text);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast); min-width: 0;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--text-3); }
.select { appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; cursor: pointer; }
.textarea { min-height: 90px; resize: vertical; }
.input-row { display: flex; gap: 10px; align-items: center; }
.input-group { display: flex; align-items: center; gap: 8px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--glass-rim-2); background: var(--glass-bg-strong); }
.input-group .input { border: 0; background: none; padding-left: 0; padding-right: 0; box-shadow: none; }
.switch { position: relative; display: inline-flex; align-items: center; width: 46px; height: 26px; border-radius: 13px; background: var(--surface-3); border: 1px solid var(--glass-rim-2); transition: background var(--dur-fast); flex: none; }
.switch::after { content: ''; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: transform var(--dur-fast) var(--ease); }
.switch[aria-checked="true"] { background: var(--accent); border-color: transparent; }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.switch-row:last-child { border-bottom: 0; }
.switch-row .t { font-weight: 600; } .switch-row .d { font-size: var(--fs-sm); color: var(--text-2); }
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--accent) var(--pct, 50%), var(--surface-3) var(--pct, 50%)); outline: none; }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); box-shadow: var(--shadow-soft); cursor: pointer; }
.range::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); cursor: pointer; }
.segmented { display: inline-flex; padding: 3px; background: var(--surface-3); border-radius: var(--radius-pill); gap: 2px; }
.segmented button { padding: 6px 12px; border-radius: var(--radius-pill); font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); }
.segmented button[aria-pressed="true"] { background: var(--glass-bg-strong); color: var(--heading); box-shadow: var(--shadow-soft); }
.color-swatch { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--glass-rim); box-shadow: var(--shadow-soft); cursor: pointer; padding: 0; overflow: hidden; }
.color-swatch input { opacity: 0; width: 100%; height: 100%; cursor: pointer; }

/* ----------------------------------------------------------- lists */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); min-width: 0; text-align: left; width: 100%; color: inherit; }
.list-row:last-child { border-bottom: 0; }
.list-row.clickable { border-radius: var(--radius-sm); padding: 10px 8px; margin: 0 -8px; width: calc(100% + 16px); transition: background var(--dur-fast); }
.list-row.clickable:hover { background: var(--surface-3); text-decoration: none; }
.list-row .thumb { width: 64px; height: 48px; border-radius: 10px; object-fit: cover; flex: none; background: var(--surface-3); }
.list-row .thumb.round { width: 44px; height: 44px; border-radius: 50%; }
.list-row .t { font-weight: 600; color: var(--heading); } .list-row .s { font-size: var(--fs-sm); color: var(--text-2); }
.list-row .ico-lead { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.list-row .trail { margin-left: auto; color: var(--text-3); display: inline-flex; align-items: center; gap: 6px; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.kv .k { font-size: var(--fs-xs); color: var(--text-3); font-weight: 600; letter-spacing: 0.03em; }
.kv .v { font-weight: 600; color: var(--heading); margin-top: 2px; word-break: break-word; }
.kv .with-ico { display: flex; gap: 12px; align-items: flex-start; }
.kv .with-ico .ico-lead { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-3); color: var(--accent); flex: none; }
.divider { height: 1px; background: var(--line); margin: 4px 0; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 28px 16px; color: var(--text-2); }
.empty-state .ico { color: var(--text-3); opacity: 0.8; }
.empty-state h4 { font-family: var(--font-ui); font-size: var(--fs-md); color: var(--heading); }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .n { font-family: var(--font-display); font-size: var(--fs-2xl); color: var(--heading); line-height: 1; }
.stat .l { font-size: var(--fs-xs); color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }

/* ----------------------------------------------------------- media */
.photo { border-radius: var(--radius-md); overflow: hidden; background: var(--surface-3); position: relative; }
.photo img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur-slow) var(--ease); }
.photo:hover img { transform: scale(1.04); }
.photo .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 20px 14px 12px; background: linear-gradient(to top, rgba(0,0,0,0.6), rgba(0,0,0,0)); color: #fff; font-size: var(--fs-sm); font-weight: 600; text-shadow: 0 1px 3px rgba(0,0,0,0.5); }
img.img-fallback, .img-fallback { background: linear-gradient(135deg, var(--accent-soft), var(--surface-3)); min-height: 40px; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); font-weight: 700; font-size: var(--fs-sm); flex: none; overflow: hidden; border: 2px solid var(--glass-rim); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.flag { font-size: 1.4em; line-height: 1; }
.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; min-height: 14px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Safety index ring */
.index-ring { --val: 0; --ring: var(--risk-green); position: relative; width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--ring) calc(var(--val) * 1%), var(--surface-3) 0); transition: background var(--dur-slow) var(--ease); }
.index-ring::before { content: ''; position: absolute; inset: 9px; border-radius: 50%; background: var(--glass-bg-strong); }
.index-ring .n { position: relative; font-family: var(--font-display); font-size: 30px; color: var(--heading); line-height: 1; }
.index-ring .d { position: relative; font-size: 10px; color: var(--text-3); font-weight: 700; margin-top: 2px; }
.index-ring.lg { width: 132px; height: 132px; } .index-ring.lg .n { font-size: 44px; } .index-ring.lg::before { inset: 12px; }
.index-ring.sm { width: 64px; height: 64px; } .index-ring.sm .n { font-size: 20px; } .index-ring.sm::before { inset: 7px; } .index-ring.sm .d { display: none; }

/* --------------------------------------------------------- tooltip */
[data-tip] { position: relative; }
[data-tip]::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%) translateY(4px); padding: 6px 10px; border-radius: 8px; background: var(--heading); color: var(--surface); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity var(--dur-fast), transform var(--dur-fast); z-index: 30; }
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translateX(-50%) translateY(0); }
[data-tip-right]::after { left: calc(100% + 10px); bottom: auto; top: 50%; transform: translateY(-50%) translateX(-4px); }
[data-tip-right]:hover::after { transform: translateY(-50%) translateX(0); }

/* ------------------------------------------------------------ app */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns var(--dur) var(--ease); }
html.sidebar-collapsed .app { grid-template-columns: var(--sidebar-collapsed-w) minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; margin: var(--gutter-sm) 0 var(--gutter-sm) var(--gutter-sm); height: calc(100vh - var(--gutter-sm) * 2); display: flex; flex-direction: column; padding: 18px 12px 14px; border-radius: var(--radius-xl); z-index: 20; overflow: hidden; }
.brand { padding: 4px 10px 14px; }
.brand-link { display: inline-flex; align-items: baseline; gap: 4px; color: var(--heading); text-decoration: none; }
.brand-word { font-family: var(--font-display); font-size: 34px; letter-spacing: 0.01em; line-height: 1; }
.brand-plane { color: var(--accent); transform: translateY(-8px) rotate(-8deg); }
.brand-tag { font-size: 9.5px; letter-spacing: 0.26em; text-transform: uppercase; color: var(--text-2); margin-top: 6px; white-space: nowrap; }
.nav { display: flex; flex-direction: column; gap: 3px; flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 2px; margin: 0 -2px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; color: var(--text-2); font-weight: 500; font-size: var(--fs-md); transition: background var(--dur-fast), color var(--dur-fast), transform var(--dur-fast) var(--ease); position: relative; white-space: nowrap; }
.nav-item:hover { background: var(--surface-3); color: var(--text); text-decoration: none; transform: translateX(2px); }
.nav-item.active { background: var(--nav-active-bg); color: var(--nav-active-ink); font-weight: 600; box-shadow: var(--shadow-soft); }
.nav-item.active .nav-ico { color: var(--accent); }
.nav-ico { display: inline-flex; width: 22px; justify-content: center; color: var(--text-3); transition: color var(--dur-fast); }
.nav-item:hover .nav-ico { color: var(--accent); }
.nav-sep { height: 1px; background: var(--line); margin: 8px 10px; }
.nav-count { margin-left: auto; font-size: 10.5px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; }
.promo { margin-top: 10px; border-radius: var(--radius-lg); overflow: hidden; position: relative; min-height: 190px; display: flex; align-items: flex-end; padding: 16px; color: #fff; cursor: pointer; text-align: left; width: 100%; border: 0; isolation: isolate; }
.promo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; transition: transform var(--dur-slow) var(--ease); }
.promo::before { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(to top, rgba(6,30,60,0.85) 0%, rgba(6,30,60,0.25) 60%, rgba(6,30,60,0) 100%); }
.promo:hover img { transform: scale(1.05); }
.promo .promo-text { font-family: var(--font-display); font-size: 20px; line-height: 1.2; text-shadow: 0 2px 8px rgba(0,0,0,0.4); }
.promo .promo-plane { margin-top: 8px; opacity: 0.9; }
.powered { margin-top: auto; padding: 12px 6px 0; font-size: 10.5px; letter-spacing: 0.04em; color: var(--text-2); text-decoration: none; white-space: nowrap; text-align: center; opacity: 0.85; }
.powered b { font-weight: 700; color: var(--heading); }
.powered:hover { opacity: 1; text-decoration: underline; }
.sidebar-toggle { position: absolute; right: 10px; top: 14px; width: 30px; height: 30px; opacity: 0; transition: opacity var(--dur-fast); }
.sidebar:hover .sidebar-toggle, .sidebar-toggle:focus-visible { opacity: 1; }
html.sidebar-collapsed .sidebar { padding-left: 10px; padding-right: 10px; }
html.sidebar-collapsed .brand-tag, html.sidebar-collapsed .nav-label, html.sidebar-collapsed .promo, html.sidebar-collapsed .nav-count, html.sidebar-collapsed .powered { display: none; }
html.sidebar-collapsed .brand-word { display: none; }
html.sidebar-collapsed .brand-plane { display: inline-flex; transform: none; width: 44px; height: 44px; align-items: center; justify-content: center; border-radius: 14px; background: var(--accent-soft); }
html.sidebar-collapsed .brand { padding: 4px 4px 12px; text-align: center; }
html.sidebar-collapsed .nav-item { justify-content: center; padding: 12px 0; }
html.sidebar-collapsed .sidebar-toggle { opacity: 1; position: static; margin: 8px auto 0; transform: rotate(180deg); }
html.sidebar-collapsed .nav-item[data-tip-right]::after { display: block; }
.nav-item::after { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: 16px; height: var(--topbar-h); padding: 0 var(--gutter); }
.topbar-brand { display: none; }
.search { position: relative; flex: 1 1 auto; max-width: 560px; margin: 0 auto; }
.search-box { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 12px 0 18px; border-radius: var(--radius-pill); }
.search-box .ico { color: var(--text-2); }
.search-box input { flex: 1; border: 0; background: none; outline: none; font-size: var(--fs-md); color: var(--text); min-width: 0; }
.search-box input::placeholder { color: var(--text-3); }
.search-box input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-box kbd { font-family: var(--font-mono); font-size: 11px; padding: 3px 7px; border-radius: 6px; background: var(--surface-3); color: var(--text-3); border: 1px solid var(--glass-rim-2); }
.topbar-right { display: flex; align-items: center; gap: 10px; position: relative; margin-left: auto; }
.vsep { width: 1px; height: 28px; background: var(--line); }
.profile-btn { display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px 3px 3px; border-radius: var(--radius-pill); color: var(--text-2); }
.profile-btn:hover { background: var(--surface-3); }
.menu { position: absolute; right: 0; top: calc(100% + 10px); min-width: 300px; max-width: min(380px, calc(100vw - 32px)); padding: 8px; border-radius: var(--radius-md); z-index: 40; box-shadow: var(--shadow-pop); transform-origin: top right; animation: menu-in var(--dur-fast) var(--ease); }
@keyframes menu-in { from { opacity: 0; transform: translateY(-6px) scale(0.98); } to { opacity: 1; transform: none; } }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 10px; color: var(--text); font-size: var(--fs-sm); text-align: left; }
.menu-item:hover { background: var(--surface-3); text-decoration: none; }
.menu-item .ico { color: var(--text-2); }
.menu-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px 6px; }
.menu-head h4 { font-family: var(--font-ui); font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); }

.view { flex: 1 1 auto; padding: 4px var(--gutter) calc(var(--gutter) + 8px); max-width: var(--content-max); width: 100%; min-width: 0; transition: opacity var(--dur-page) var(--ease), transform var(--dur-page) var(--ease); }
.view.page-enter { opacity: 0; transform: translateY(10px); }
.view.page-leave { opacity: 0; transform: translateY(-6px); transition-duration: var(--dur-fast); }

/* Bottom nav + drawer (mobile) */
.bottom-nav { display: none; }
#drawer-backdrop { display: none; }

/* ------------------------------------------------------- animated bg */
.bg-layer { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-layer .blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.55; mix-blend-mode: screen; will-change: transform; }
.bg-layer .b1 { width: 55vw; height: 55vw; left: -12vw; top: -18vw; background: radial-gradient(circle, rgba(255,255,255,0.9), rgba(255,255,255,0) 65%); }
.bg-layer .b2 { width: 48vw; height: 48vw; right: -14vw; top: 8vh; background: radial-gradient(circle, rgba(var(--globe-glow), 0.55), rgba(255,255,255,0) 65%); }
.bg-layer .b3 { width: 60vw; height: 60vw; left: 20vw; bottom: -30vw; background: radial-gradient(circle, rgba(255,255,255,0.5), rgba(255,255,255,0) 65%); }
html.dark .bg-layer .blob { opacity: 0.35; }
html.animated-bg:not(.reduce-motion) .bg-layer .b1 { animation: drift1 38s ease-in-out infinite alternate; }
html.animated-bg:not(.reduce-motion) .bg-layer .b2 { animation: drift2 46s ease-in-out infinite alternate; }
html.animated-bg:not(.reduce-motion) .bg-layer .b3 { animation: drift3 52s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(14vw, 10vh) scale(1.12); } }
@keyframes drift2 { to { transform: translate(-12vw, 16vh) scale(0.92); } }
@keyframes drift3 { to { transform: translate(-16vw, -10vh) scale(1.08); } }
.bg-layer .waves { position: absolute; left: 0; right: 0; bottom: -2px; height: 26vh; opacity: 0.35; }
.bg-layer .waves path { fill: rgba(255,255,255,0.35); }
html.dark .bg-layer .waves path { fill: rgba(255,255,255,0.06); }
/* A person's own theme photo behind the glass (data-photo = on): the vault's object URL in --page-photo, a wash in
   the base colour (--page-photo-dim-rgb) at --page-photo-dim so the glass stays readable, optional blur. */
.bg-layer .photo { position: absolute; inset: -40px; background-image: var(--page-photo); background-size: cover; background-position: var(--page-photo-pos, 50% 50%); background-repeat: no-repeat; filter: blur(var(--page-photo-blur, 0px)); opacity: 0; transition: opacity var(--dur-slow) var(--ease); }
.bg-layer .photo::after { content: ''; position: absolute; inset: 0; background: rgba(var(--page-photo-dim-rgb, 255, 255, 255), var(--page-photo-dim, 0.25)); }
html[data-photo="on"] .bg-layer .photo { opacity: 1; }
html[data-photo="on"] .bg-layer .blob { opacity: 0.28; }
html[data-photo="on"] .bg-layer .waves { opacity: 0.16; }
html.animated-bg:not(.reduce-motion) .bg-layer .waves .w1 { animation: wave 18s linear infinite; }
html.animated-bg:not(.reduce-motion) .bg-layer .waves .w2 { animation: wave 26s linear infinite reverse; opacity: 0.6; }
@keyframes wave { from { transform: translateX(0); } to { transform: translateX(-50%); } }
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }

/* ---------------------------------------------------------- modal */
#modal-root { position: relative; z-index: 100; }
.modal-overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--backdrop); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; transition: opacity var(--dur-fast) var(--ease); z-index: 100; overflow-y: auto; }
.modal-overlay.in { opacity: 1; }
.modal { width: 100%; max-width: 640px; max-height: calc(100vh - 48px); display: flex; flex-direction: column; border-radius: var(--radius-xl); transform: translateY(14px) scale(0.98); transition: transform var(--dur) var(--ease-spring); background: var(--glass-bg-strong); box-shadow: var(--shadow-pop); outline: none; }
.modal-overlay.in .modal { transform: none; }
.modal-overlay.closing { pointer-events: none; }
.modal-sm { max-width: 440px; } .modal-lg { max-width: 900px; } .modal-full { max-width: min(1240px, 96vw); height: calc(100vh - 48px); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px 8px; }
.modal-head-bare { padding: 12px 12px 0; justify-content: flex-end; }
.modal-title { font-size: var(--fs-2xl); } .modal-subtitle { color: var(--text-2); font-size: var(--fs-sm); margin-top: 4px; }
.modal-body { padding: 10px 24px 22px; overflow-y: auto; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 14px; }
.modal-text { color: var(--text-2); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 0 24px 22px; flex-wrap: wrap; }
.modal-full .modal-body { padding: 0 24px 24px; }

/* ----------------------------------------------------------- toast */
#toast-root { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 200; align-items: center; pointer-events: none; width: min(92vw, 460px); }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: var(--radius-pill); font-size: var(--fs-sm); font-weight: 600; color: var(--text); background: var(--glass-bg-strong); box-shadow: var(--shadow-pop); opacity: 0; transform: translateY(12px); transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease-spring); pointer-events: auto; cursor: pointer; max-width: 100%; }
.toast.in { opacity: 1; transform: none; }
.toast-success .ico { color: var(--risk-green); } .toast-warning .ico { color: var(--risk-orange); } .toast-error .ico { color: var(--risk-red); } .toast-info .ico { color: var(--accent); }

/* ------------------------------------------------------- home layout */
.home-grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); grid-template-areas: "globe panel" "cards cards" "cards2 cards2" "cards3 cards3"; gap: var(--gutter); align-items: start; }
.home-globe { grid-area: globe; position: sticky; top: calc(var(--topbar-h) + 4px); height: min(640px, calc(100vh - var(--topbar-h) - 24px)); min-height: 520px; min-width: 0; align-self: start; }
.home-panel { grid-area: panel; min-width: 0; }
.home-cards { grid-area: cards; } .home-cards + .home-cards { grid-area: cards2; } .home-cards.home-cards-c { grid-area: cards3; }
.home-cards > .card { min-height: 250px; }
@media (max-width: 1180px) {
  .home-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "globe" "panel" "cards" "cards2" "cards3"; }
  .home-globe { position: relative; top: auto; height: auto; min-height: 520px; }
}
@media (max-width: 760px) { .home-globe { min-height: 96vw; } }
@media (max-height: 1060px) { .promo { display: none; } }

/* ------------------------------------------------- generic page bits */
.page-error { padding: 40px; text-align: center; }
.hero-band { padding: 30px 34px; border-radius: var(--radius-xl); position: relative; overflow: hidden; isolation: isolate; }
.hero-band img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.hero-band::before { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(4,30,55,0.78), rgba(4,30,55,0.25)); }
.hero-band, .hero-band h1, .hero-band h2 { color: #fff; }
.lightbox-img { width: 100%; max-height: 70vh; object-fit: contain; border-radius: var(--radius-md); background: #000; }
.credit { font-size: var(--fs-xs); color: var(--text-3); } .credit a { color: inherit; text-decoration: underline; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--text-2); font-size: var(--fs-sm); }
.notice .ico { color: var(--accent); flex: none; margin-top: 1px; }
.notice.warn { background: var(--risk-orange-soft); } .notice.warn .ico { color: var(--risk-orange); }
.dest-tile { position: relative; border-radius: var(--radius-lg); overflow: hidden; aspect-ratio: 4 / 3; display: flex; align-items: flex-end; padding: 16px; color: #fff; text-align: left; width: 100%; isolation: isolate; cursor: pointer; transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease); box-shadow: var(--shadow-soft); }
.dest-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; transition: transform var(--dur-slow) var(--ease); }
.dest-tile::before { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(to top, rgba(4,20,40,0.85), rgba(4,20,40,0.05) 60%); }
.dest-tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-pop); } .dest-tile:hover img { transform: scale(1.06); }
.dest-tile img.img-fallback { background: linear-gradient(140deg, var(--accent-2), var(--accent) 45%, var(--bg-4)); }
.dest-tile-flag { position: absolute; left: 0; right: 0; top: 22%; text-align: center; font-size: 68px; line-height: 1; z-index: -1; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.25)); }
.hero-band img.img-fallback { background: linear-gradient(140deg, var(--accent-2), var(--accent) 45%, var(--bg-4)); }
.dest-tile .name { font-family: var(--font-display); font-size: var(--fs-xl); line-height: 1.1; text-shadow: 0 2px 8px rgba(0,0,0,0.4); }
.dest-tile .sub { font-size: var(--fs-sm); opacity: 0.85; margin-top: 4px; }
.dest-tile .corner { position: absolute; top: 12px; right: 12px; display: flex; gap: 6px; }
.dest-tile .corner .icon-btn { width: 34px; height: 34px; background: rgba(255,255,255,0.22); border-color: rgba(255,255,255,0.35); color: #fff; }
.dest-tile .corner .icon-btn.on { color: var(--risk-red); background: rgba(255,255,255,0.9); }
.dest-tile .risk-pill { position: absolute; top: 12px; left: 12px; }

/* --------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  :root { --gutter: 16px; }
  .app { grid-template-columns: var(--sidebar-collapsed-w) minmax(0, 1fr); }
  .sidebar { padding-left: 10px; padding-right: 10px; }
  .brand-tag, .nav-label, .promo, .nav-count, .sidebar-toggle, .powered { display: none !important; }
  .brand-word { display: none; } .brand-plane { display: inline-flex; transform: none; width: 44px; height: 44px; align-items: center; justify-content: center; border-radius: 14px; background: var(--accent-soft); } .brand { padding: 4px 4px 12px; text-align: center; }
  .nav-item { justify-content: center; padding: 12px 0; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  :root { --gutter: 14px; --topbar-h: 64px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; height: 100vh; width: min(300px, 84vw); margin: 0; border-radius: 0 var(--radius-xl) var(--radius-xl) 0; transform: translateX(-104%); transition: transform var(--dur) var(--ease); z-index: 60; padding: 18px 14px; }
  html.drawer-open .sidebar { transform: none; }
  .brand-tag, .nav-label, .promo { display: block !important; } .nav-count { display: inline-flex !important; }
  .brand-word { font-size: 32px; } .brand-plane { display: inline-flex; } .brand { text-align: left; padding: 4px 10px 14px; }
  .nav-item { justify-content: flex-start; padding: 12px 12px; }
  #drawer-backdrop { display: block; position: fixed; inset: 0; background: var(--backdrop); z-index: 55; opacity: 0; pointer-events: none; transition: opacity var(--dur); }
  html.drawer-open #drawer-backdrop { opacity: 1; pointer-events: auto; }
  .topbar { gap: 10px; padding: 0 var(--gutter); }
  .topbar-brand { display: block; font-family: var(--font-display); font-size: 24px; color: var(--heading); }
  .search { max-width: none; margin: 0; min-width: 0; }   /* may shrink below its placeholder, or the bar pushes the whole page wider than the phone */
  .search-box { height: 42px; padding-left: 12px; } .search-box kbd { display: none; }
  .vsep { display: none; } .profile-btn .ico { display: none; }
  .view { padding-bottom: calc(var(--bottom-nav-h) + 24px); }
  .bottom-nav { display: flex; position: fixed; left: 10px; right: 10px; bottom: 10px; height: var(--bottom-nav-h); z-index: 50; border-radius: var(--radius-lg); align-items: stretch; justify-content: space-around; padding: 6px; }
  .bottom-nav a, .bottom-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 10.5px; font-weight: 600; color: var(--text-2); border-radius: 12px; }
  .bottom-nav .active { color: var(--accent); background: var(--accent-soft); }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: 1fr 1fr; gap: 12px; }
  .card { padding: 16px; }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { max-height: 92vh; border-bottom-left-radius: 0; border-bottom-right-radius: 0; max-width: none; }
  .modal-full { height: 96vh; }
  .modal-head { padding: 18px 18px 6px; } .modal-body { padding: 8px 18px 18px; } .modal-actions { padding: 0 18px 18px; }
  #toast-root { bottom: calc(var(--bottom-nav-h) + 20px); }
  .page-head h1 { font-size: var(--fs-2xl); }
}
@media (max-width: 420px) {
  .topbar-brand { display: none; }   /* narrow phones: the search box needs the room; the drawer still shows the full logo */
}
@media (min-width: 761px) { .menu-btn { display: none; } }
@media (hover: none) { .sidebar-toggle { opacity: 1; } [data-tip]::after { display: none; } }

/* ---------------------------------------------- offline pill (topbar) */
.net-pill { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: var(--radius-pill); background: var(--risk-orange-soft); color: var(--risk-orange-ink); font-size: var(--fs-xs); font-weight: 700; white-space: nowrap; }
.net-pill[hidden] { display: none; }
/* Offline: links to the web are kept visible but shown as unavailable (shell.js stops them and explains). */
html.is-offline a[target="_blank"] { opacity: 0.55; cursor: not-allowed; }
.card-title > .ico { color: var(--accent); vertical-align: -3px; }
