:root {
  color-scheme: light;
  --ink: #172b3d;
  --muted: #728294;
  --line: #e5ebf0;
  --soft: #f5f8fa;
  --blue: #1197c6;
  --blue-dark: #087aa5;
  --blue-wash: #e8f6fb;
  --navy: #142a3c;
  --green: #19a876;
  --amber: #e8a23b;
  --red: #dc665e;
  --shadow: 0 8px 26px rgba(30, 54, 76, .08);
  font-family: 'DM Sans', 'Segoe UI', sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
body { min-width: 360px; background: #eef3f6; color: var(--ink); overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible { outline: 3px solid rgba(17, 151, 198, .28); outline-offset: 2px; }

.app-shell {
  width: 100%; height: 100dvh; min-height: 560px;
  display: grid; grid-template-columns: 66px 340px minmax(280px, 1fr) 350px;
  grid-template-rows: 72px minmax(0, 1fr); background: #fff;
}
.app-shell[hidden], .auth-screen[hidden] { display: none !important; }
.topbar {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 22px;
  padding: 0 25px 0 20px; border-bottom: 1px solid var(--line); background: #fff; z-index: 500;
}
.brand { display: inline-flex; align-items: center; gap: 10px; width: 174px; text-decoration: none; color: var(--ink); }
.brand-mark { position: relative; display: inline-flex; align-items: end; gap: 3px; width: 30px; height: 27px; transform: skewY(-9deg); }
.brand-mark span { width: 7px; border-radius: 4px 4px 2px 2px; background: var(--blue); display: block; }
.brand-mark span:nth-child(1) { height: 13px; opacity: .58; }
.brand-mark span:nth-child(2) { height: 21px; opacity: .8; }
.brand-mark span:nth-child(3) { height: 27px; }
.brand-name { font: 800 21px/1 'Manrope', sans-serif; letter-spacing: -.8px; }
.brand-dot { color: var(--blue); }
.topbar-divider { height: 32px; width: 1px; background: var(--line); }
.page-title { display: grid; gap: 2px; }
.eyebrow, .section-kicker { color: #93a1af; font-size: 9px; font-weight: 700; letter-spacing: 1.25px; }
.page-title strong { font: 700 17px/1.1 'Manrope', sans-serif; letter-spacing: -.2px; }
.topbar-spacer { flex: 1; }
.api-status { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.status-orb, .live-pulse { width: 8px; height: 8px; border-radius: 50%; background: #a8b4bf; }
.api-status[data-state="connected"] .status-orb { background: var(--green); box-shadow: 0 0 0 4px rgba(25,168,118,.1); }
.api-status[data-state="error"] .status-orb { background: var(--red); }
.api-status[data-state="loading"] .status-orb { background: var(--amber); animation: pulse 1.2s infinite; }
.update-stamp { color: #9aa6b1; font-size: 11px; white-space: nowrap; }
.account-button { border: 0; border-left: 1px solid var(--line); background: transparent; display: flex; align-items: center; gap: 10px; padding: 3px 0 3px 18px; cursor: pointer; text-align: left; }
.account-avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: #fff; background: #1d9fc9; font-weight: 700; font-size: 14px; }
.account-copy { display: grid; gap: 2px; min-width: 120px; }
.account-copy strong { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.account-copy small { color: #8a98a6; font-size: 10px; }
.account-button > svg { width: 16px; height: 16px; fill: none; stroke: #8292a0; stroke-width: 1.7; }

.navrail { grid-column: 1; grid-row: 2; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 15px 0; background: var(--navy); z-index: 400; }
.rail-button { width: 42px; height: 42px; border: 0; border-radius: 12px; background: transparent; display: grid; place-items: center; color: #a4b7c5; cursor: pointer; transition: .16s ease; }
.rail-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.rail-button.active { color: #fff; background: rgba(19, 154, 200, .25); box-shadow: inset 3px 0 #21add8; }
.rail-button:not(:disabled):hover { color: #fff; background: rgba(255,255,255,.08); }
.rail-button:disabled { opacity: .4; cursor: default; }
.rail-spacer { flex: 1; }
.help-button { margin-bottom: 3px; }

.objects-panel { grid-column: 2; grid-row: 2; min-height: 0; display: flex; flex-direction: column; background: #fff; border-right: 1px solid var(--line); z-index: 300; }
.objects-heading { display: flex; justify-content: space-between; align-items: center; padding: 21px 19px 17px; }
.objects-heading h1 { margin: 5px 0 0; font: 750 21px/1.1 'Manrope', sans-serif; letter-spacing: -.55px; }
.total-count { display: inline-flex; vertical-align: 2px; justify-content: center; align-items: center; min-width: 22px; height: 21px; padding: 0 6px; border-radius: 7px; color: #668091; background: #eef3f6; font: 700 11px 'DM Sans', sans-serif; letter-spacing: 0; }
.icon-button { width: 33px; height: 33px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: #6d7e8c; cursor: pointer; }
.icon-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-button:hover { color: var(--blue); border-color: #b4dce9; background: #f5fbfd; }
.refresh-button { margin-top: 10px; }
.refresh-button.spinning svg { animation: rotate 0.8s linear infinite; }
.search-box { display: flex; align-items: center; gap: 9px; height: 39px; margin: 0 15px 14px; padding: 0 10px; border: 1px solid #e1e8ed; border-radius: 9px; background: #f9fbfc; color: #93a1ac; }
.search-box:focus-within { border-color: #7ec9df; box-shadow: 0 0 0 3px rgba(17,151,198,.08); }
.search-box svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; flex: 0 0 auto; }
.search-box input { min-width: 0; width: 100%; height: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 12px; }
.search-box input::placeholder { color: #a8b3bd; }
.search-box kbd { padding: 1px 5px; border: 1px solid #e3e9ed; border-radius: 4px; background: #fff; font: 10px 'DM Sans', sans-serif; }
.filter-row { display: flex; gap: 5px; padding: 0 15px 15px; }
.filter-chip { display: inline-flex; align-items: center; gap: 5px; padding: 6px 8px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: #7f8f9d; font-size: 10px; cursor: pointer; white-space: nowrap; }
.filter-chip span { display: inline-grid; place-items: center; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 5px; color: #8594a0; background: #edf2f5; font-size: 9px; }
.filter-chip:hover { background: #f7fafb; }
.filter-chip.active { border-color: #d5edf5; background: #eff9fc; color: #0787b5; font-weight: 700; }
.filter-chip.active span { background: #d9f1f8; color: #087da3; }
.list-meta { display: flex; justify-content: space-between; padding: 0 18px 9px; color: #9ca9b4; font-size: 8px; font-weight: 700; letter-spacing: .9px; border-bottom: 1px solid #eef2f5; }
.object-list { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #d8e1e7 transparent; }
.object-list::-webkit-scrollbar { width: 5px; }
.object-list::-webkit-scrollbar-thumb { border-radius: 5px; background: #d8e1e7; }
.object-row { position: relative; display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 67px; padding: 9px 14px 9px 17px; border-bottom: 1px solid #f0f3f5; cursor: pointer; transition: background .14s ease; }
.object-row:hover { background: #f8fbfc; }
.object-row.selected { background: #eff9fc; }
.object-row.selected::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--blue); }
.row-state-icon { width: 23px; height: 23px; display: grid; place-items: center; border-radius: 7px; background: #edf6f8; color: #0e9bc7; }
.row-state-icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.row-state-icon.parked { color: #56a787; background: #edf7f2; }
.row-state-icon.stale, .row-state-icon.none, .row-state-icon.disabled { color: #8997a3; background: #f0f3f5; }
.row-main { min-width: 0; display: grid; gap: 4px; }
.row-name { overflow: hidden; color: #2a4052; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 650; }
.row-identifier { overflow: hidden; color: #9aa7b1; text-overflow: ellipsis; white-space: nowrap; font: 9px 'DM Sans', sans-serif; }
.row-last { min-width: 48px; display: grid; justify-items: end; gap: 4px; color: #93a0ab; font-size: 9px; white-space: nowrap; }
.row-speed { color: #4f6978; font-size: 11px; font-weight: 700; }
.row-speed.moving { color: #1289b2; }
.empty-list, .list-placeholder { min-height: 145px; padding: 26px 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; color: #9aa8b2; text-align: center; font-size: 11px; }
.empty-list strong { color: #637787; font-size: 12px; }
.spinner { width: 18px; height: 18px; border: 2px solid #dce8ed; border-top-color: var(--blue); border-radius: 50%; animation: rotate .8s linear infinite; }
.objects-footer { display: flex; justify-content: space-between; align-items: center; padding: 11px 16px; border-top: 1px solid var(--line); color: #9aa7b1; font-size: 9px; }
.footer-live { display: inline-flex; align-items: center; gap: 7px; color: #6d8795; }
.live-pulse { width: 6px; height: 6px; background: var(--green); box-shadow: 0 0 0 3px rgba(25,168,118,.12); }

.map-area { grid-column: 3; grid-row: 2; position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #e8f0ef; }
#map { position: absolute; inset: 0; z-index: 1; background: #e7efee; }
.leaflet-container { font: 12px 'DM Sans', sans-serif; background: #e8efed; }
.leaflet-control-zoom { border: 0 !important; border-radius: 10px !important; overflow: hidden; box-shadow: var(--shadow) !important; }
.leaflet-control-zoom a { width: 32px !important; height: 32px !important; line-height: 32px !important; color: #4a6270 !important; border-color: #e8edf0 !important; }
.leaflet-control-attribution { font-size: 9px !important; }
.map-topline { position: absolute; top: 16px; left: 16px; right: 16px; z-index: 250; display: flex; justify-content: space-between; gap: 10px; pointer-events: none; }
.map-context, .map-actions { display: inline-flex; align-items: center; gap: 10px; min-height: 39px; padding: 0 12px; border: 1px solid rgba(225,232,236,.92); border-radius: 10px; background: rgba(255,255,255,.95); box-shadow: 0 3px 12px rgba(28,49,66,.08); backdrop-filter: blur(8px); pointer-events: auto; }
.map-context { font-size: 10px; color: #83929f; }
.map-context strong { color: #334c5d; font-size: 11px; }
.map-pin { width: 8px; height: 8px; border-radius: 50% 50% 50% 0; background: var(--blue); transform: rotate(-45deg); }
.context-divider { height: 14px; width: 1px; background: var(--line); }
.map-actions { gap: 3px; padding: 3px; }
.map-action { min-height: 30px; display: inline-flex; align-items: center; gap: 6px; padding: 0 9px; border: 0; border-radius: 7px; background: transparent; color: #6b7d8c; cursor: pointer; font-size: 10px; }
.map-action:hover { background: #eff8fb; color: #0789b4; }
.map-action svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.map-legend { position: absolute; right: 16px; bottom: 17px; z-index: 250; display: flex; align-items: center; gap: 12px; padding: 9px 11px; border: 1px solid rgba(225,232,236,.92); border-radius: 9px; background: rgba(255,255,255,.94); color: #667b88; box-shadow: 0 3px 12px rgba(28,49,66,.08); font-size: 9px; backdrop-filter: blur(7px); }
.map-legend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.legend-dot.parked { background: #7b9d8f; }
.legend-dot.stale { background: #a0aab3; }
.map-attribution-note { position: absolute; left: 9px; bottom: 4px; z-index: 2; color: #60756f; opacity: .8; font-size: 8px; pointer-events: none; }
.map-empty { position: absolute; inset: 0; z-index: 10; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 8px; padding: 24px; text-align: center; pointer-events: none; }
.map-empty[hidden] { display: none; }
.map-empty strong { color: #3e5960; font: 700 17px 'Manrope', sans-serif; }
.map-empty > span:last-child { max-width: 260px; color: #71878b; font-size: 11px; line-height: 1.5; }
.map-empty-icon { display: grid; place-items: center; width: 49px; height: 49px; margin-bottom: 3px; border-radius: 16px; background: rgba(255,255,255,.84); box-shadow: var(--shadow); }
.map-empty-icon svg { width: 23px; height: 23px; fill: none; stroke: #179cc2; stroke-width: 1.7; }
.map-fallback { position: absolute; inset: 0; z-index: 15; display: grid; place-items: center; background: #eaf1ef; }
.map-fallback[hidden] { display: none; }
.map-fallback-card { display: grid; gap: 6px; max-width: 300px; padding: 20px 22px; border: 1px solid #dae6e2; border-radius: 13px; background: #fff; box-shadow: var(--shadow); text-align: center; }
.map-fallback-card strong { font-size: 13px; }
.map-fallback-card span { color: var(--muted); font-size: 11px; line-height: 1.5; }
.object-marker { width: 33px; height: 39px; position: relative; display: grid; place-items: center; }
.object-marker .marker-shadow { position: absolute; left: 50%; bottom: 2px; width: 23px; height: 8px; border-radius: 50%; background: rgba(20,43,57,.2); filter: blur(2px); transform: translateX(-50%); }
.object-marker .marker-body { position: relative; z-index: 1; display: grid; place-items: center; width: 27px; height: 27px; border: 2px solid #fff; border-radius: 11px; color: #fff; background: var(--green); box-shadow: 0 2px 8px rgba(24,51,64,.25); }
.object-marker .marker-body svg { width: 15px; height: 15px; fill: currentColor; transform-origin: 50% 50%; }
.object-marker.parked .marker-body { background: #699686; }
.object-marker.stale .marker-body, .object-marker.none .marker-body { background: #97a4ad; }
.object-marker.moving .marker-body { background: #129cc5; }
.object-marker.selected .marker-body { outline: 3px solid rgba(17,151,198,.25); transform: scale(1.12); }

.detail-panel { grid-column: 4; grid-row: 2; min-height: 0; display: flex; flex-direction: column; background: #fff; border-left: 1px solid var(--line); z-index: 300; }
.detail-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 30px; color: #91a0ac; text-align: center; }
.detail-empty[hidden] { display: none; }
.empty-illustration { display: grid; place-items: center; width: 82px; height: 82px; margin-bottom: 6px; border: 1px solid #e8eef1; border-radius: 24px; background: #f7fafb; }
.empty-illustration svg { width: 62px; height: 62px; fill: none; stroke: #9ab9c3; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.detail-empty strong { color: #516879; font: 700 15px 'Manrope', sans-serif; }
.detail-empty > span:last-child { max-width: 235px; font-size: 11px; line-height: 1.55; }
#detailContent { min-height: 0; height: 100%; display: flex; flex-direction: column; }
#detailContent[hidden] { display: none; }
.detail-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 9px; padding: 21px 19px 15px; }
.detail-title-wrap { min-width: 0; }
.object-status-line { display: flex; align-items: center; gap: 7px; color: #7e8e9b; font-size: 10px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #9aa7b0; }
.status-dot.moving { background: var(--blue); box-shadow: 0 0 0 4px rgba(17,151,198,.11); }
.status-dot.parked { background: var(--green); }
.status-dot.stale, .status-dot.none, .status-dot.disabled { background: #a1adb5; }
.status-dot.speeding { background: var(--red); box-shadow: 0 0 0 4px rgba(220,102,94,.11); }
.detail-header h2 { overflow-wrap: anywhere; margin: 8px 0 3px; color: #243c4d; font: 750 19px/1.2 'Manrope', sans-serif; letter-spacing: -.35px; }
.detail-imei { color: #9aa6b0; font-size: 10px; }
.detail-close { flex: 0 0 auto; color: #91a0aa; font-size: 23px; line-height: 1; }
.detail-tabs { display: flex; gap: 3px; padding: 0 15px; border-bottom: 1px solid var(--line); }
.detail-tab { position: relative; padding: 10px 8px 11px; border: 0; background: transparent; color: #8997a3; font-size: 10px; cursor: pointer; }
.detail-tab.active { color: #118bb2; font-weight: 700; }
.detail-tab.active::after { content: ''; position: absolute; right: 7px; bottom: -1px; left: 7px; height: 2px; border-radius: 2px; background: var(--blue); }
.tab-badge { display: inline-grid; min-width: 15px; height: 15px; margin-left: 3px; padding: 0 3px; place-items: center; border-radius: 5px; background: #fcedeb; color: #c45c54; font-size: 8px; }
.detail-body { min-height: 0; flex: 1; overflow-y: auto; padding: 15px 17px 21px; scrollbar-width: thin; scrollbar-color: #dde5e9 transparent; }
.detail-body::-webkit-scrollbar { width: 4px; }
.detail-body::-webkit-scrollbar-thumb { border-radius: 4px; background: #dce4e9; }
.detail-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; padding: 0 16px; border-top: 1px solid var(--line); color: #99a5ae; font-size: 9px; }
.detail-bottom button { display: inline-flex; align-items: center; gap: 5px; border: 0; background: transparent; color: #0d8eb8; font-size: 10px; font-weight: 650; cursor: pointer; white-space: nowrap; }
.detail-bottom button:hover { color: #056d94; }
.detail-bottom button svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.status-banner { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 14px; padding: 10px; border-radius: 9px; background: #eef8f6; color: #4d776b; font-size: 10px; line-height: 1.45; }
.status-banner.warning { background: #fff7ea; color: #97703c; }
.status-banner.danger { background: #fff1ef; color: #a55d57; }
.banner-icon { flex: 0 0 auto; display: grid; place-items: center; width: 19px; height: 19px; border-radius: 6px; background: rgba(255,255,255,.72); }
.banner-icon svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.metrics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.metric-card { min-height: 83px; display: flex; flex-direction: column; justify-content: space-between; padding: 10px; border: 1px solid #e9eef1; border-radius: 10px; background: #fbfcfd; }
.metric-label { display: inline-flex; align-items: center; gap: 5px; color: #8c9aa5; font-size: 9px; }
.metric-label svg { width: 13px; height: 13px; fill: none; stroke: #93aab4; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.metric-value { display: flex; align-items: baseline; gap: 3px; color: #263f50; font: 750 20px/1 'Manrope', sans-serif; letter-spacing: -.5px; }
.metric-value small { color: #84939f; font: 500 10px 'DM Sans', sans-serif; letter-spacing: 0; }
.detail-section { margin-top: 18px; }
.detail-section-title { display: flex; justify-content: space-between; align-items: center; margin: 0 0 8px; color: #718391; font-size: 9px; font-weight: 750; letter-spacing: .85px; text-transform: uppercase; }
.position-card { padding: 11px; border: 1px solid #e9eef1; border-radius: 10px; }
.position-coordinate { color: #40596a; font: 600 11px 'DM Sans', sans-serif; }
.position-note { margin-top: 5px; color: #99a6af; font-size: 9px; }
.data-rows { display: grid; }
.data-row { display: flex; justify-content: space-between; gap: 14px; padding: 8px 0; border-bottom: 1px solid #f0f3f5; font-size: 10px; }
.data-row:last-child { border-bottom: 0; }
.data-row span { color: #84939f; }
.data-row strong { color: #40596a; text-align: right; font-weight: 650; }
.speed-alert { display: flex; align-items: center; gap: 7px; margin-top: 12px; padding: 9px 10px; border: 1px solid #f3ddda; border-radius: 9px; background: #fff6f4; color: #b5574f; font-size: 10px; font-weight: 650; }
.speed-alert svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.section-action { display: inline-flex; align-items: center; gap: 6px; padding: 7px 9px; border: 1px solid #d5eaf1; border-radius: 7px; background: #f4fbfd; color: #0b89b3; font-size: 9px; font-weight: 700; cursor: pointer; }
.section-action:hover { background: #e7f7fb; }
.section-action svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.event-list, .history-list { display: grid; }
.event-item { position: relative; display: grid; grid-template-columns: 20px minmax(0,1fr) auto; align-items: start; gap: 8px; padding: 10px 0; border-bottom: 1px solid #eff3f5; }
.event-symbol { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 7px; background: #eff8fb; color: #1699bf; }
.event-symbol.warning { background: #fff2ef; color: #d4675d; }
.event-symbol svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.event-title { color: #455d6e; font-size: 10px; font-weight: 650; line-height: 1.35; }
.event-subtitle { margin-top: 3px; color: #9aa6af; font-size: 9px; }
.event-time { color: #96a2ad; font-size: 8px; white-space: nowrap; }
.history-item { display: grid; grid-template-columns: 1fr auto; gap: 6px; padding: 9px 0; border-bottom: 1px solid #eff3f5; font-size: 9px; }
.history-item strong { color: #5b7080; font-size: 9px; font-weight: 600; }
.history-item span { color: #82919c; text-align: right; }
.content-empty { padding: 26px 10px; color: #9aa7b1; text-align: center; font-size: 10px; line-height: 1.5; }
.content-loading { display: flex; justify-content: center; padding: 24px; }
.notice-card { padding: 12px; border: 1px dashed #dce5e9; border-radius: 9px; color: #80909c; font-size: 10px; line-height: 1.5; }

.toast { position: fixed; left: 50%; bottom: 22px; z-index: 1000; max-width: calc(100vw - 30px); padding: 10px 15px; border-radius: 9px; color: #fff; background: #213c4e; box-shadow: 0 5px 20px rgba(20,43,60,.2); font-size: 11px; opacity: 0; pointer-events: none; transform: translate(-50%, 9px); transition: .2s ease; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #a84f49; }
.settings-dialog { width: min(440px, calc(100vw - 28px)); padding: 0; border: 1px solid #e1e8ed; border-radius: 16px; color: var(--ink); box-shadow: 0 24px 80px rgba(16,42,61,.25); }
.settings-dialog::backdrop { background: rgba(16,34,48,.35); backdrop-filter: blur(2px); }
.settings-dialog form { padding: 22px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; }
.dialog-heading h2 { margin: 5px 0 0; font: 750 20px 'Manrope', sans-serif; letter-spacing: -.5px; }
.dialog-close { font-size: 21px; line-height: 1; }
.settings-dialog p { margin: 12px 0 17px; color: #7e8f9d; font-size: 11px; line-height: 1.55; }
.field-label { display: block; margin: 13px 0 6px; color: #546c7d; font-size: 10px; font-weight: 700; }
.text-field { width: 100%; height: 38px; padding: 0 10px; border: 1px solid #dce5ea; border-radius: 8px; color: #365063; background: #fbfcfd; font: 10px 'DM Sans', sans-serif; }
.dialog-note { display: flex; gap: 8px; margin-top: 15px; padding: 10px; border-radius: 8px; color: #91733e; background: #fff8eb; font-size: 9px; line-height: 1.5; }
.dialog-note svg { flex: 0 0 auto; width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 19px; }
.primary-button, .secondary-button { min-height: 35px; padding: 0 14px; border-radius: 8px; font-size: 10px; font-weight: 700; cursor: pointer; }
.primary-button { border: 1px solid var(--blue); color: #fff; background: var(--blue); }
.primary-button:hover { background: var(--blue-dark); }
.secondary-button { border: 1px solid #dce5ea; color: #6d7f8c; background: #fff; }

.auth-screen { position: fixed; inset: 0; z-index: 1200; display: grid; place-items: center; overflow: auto; padding: 28px 18px; background: radial-gradient(ellipse at 12% 10%, #e1f4f9 0, transparent 38%), radial-gradient(ellipse at 92% 88%, #e9f0f8 0, transparent 35%), #f4f7f9; }
.auth-card { width: min(100%, 430px); padding: 34px; border: 1px solid #e5ebf0; border-radius: 20px; background: rgba(255,255,255,.96); box-shadow: 0 20px 70px rgba(30,54,76,.12); }
.auth-brand { width: auto; margin-bottom: 35px; }
.auth-heading h1 { margin: 10px 0 8px; font: 750 25px/1.15 'Manrope', sans-serif; letter-spacing: -.7px; }
.auth-heading p { margin: 0; color: #7b8d9b; font-size: 12px; line-height: 1.55; }
.auth-form { display: grid; gap: 0; margin-top: 24px; }
.auth-form[hidden] { display: none; }
.auth-form .field-label { margin-top: 13px; font-size: 11px; }
.auth-form .text-field { height: 44px; padding: 0 12px; font-size: 13px; }
.auth-form .text-field:focus { border-color: #77c8df; box-shadow: 0 0 0 3px rgba(17,151,198,.09); outline: 0; }
.auth-submit { min-height: 43px; margin-top: 19px; font-size: 12px; }
.auth-submit:disabled { opacity: .62; cursor: wait; }
.auth-link { justify-self: center; margin-top: 14px; padding: 5px 8px; border: 0; color: #0989b4; background: transparent; font-size: 11px; cursor: pointer; }
.auth-link:hover { text-decoration: underline; }
.auth-error { margin-top: 13px; padding: 10px 11px; border: 1px solid #f1d6d2; border-radius: 8px; color: #a74f49; background: #fff5f3; font-size: 11px; line-height: 1.45; }
.auth-error[hidden] { display: none; }
.setup-callout { display: grid; gap: 4px; margin-bottom: 4px; padding: 11px 12px; border-radius: 9px; color: #536b7b; background: #eff8fb; font-size: 10px; line-height: 1.45; }
.setup-callout strong { color: #1d6179; font-size: 11px; }
.auth-footnote { display: flex; align-items: center; gap: 8px; margin-top: 27px; padding-top: 17px; border-top: 1px solid #edf1f3; color: #98a5af; font-size: 9px; }
.auth-footnote .live-pulse { background: #19a876; box-shadow: 0 0 0 4px rgba(25,168,118,.1); }
.profile-content { padding: 22px; }
.profile-row { display: flex; justify-content: space-between; gap: 16px; margin-top: 14px; padding: 12px; border: 1px solid #edf1f4; border-radius: 9px; color: #81909c; font-size: 11px; }
.profile-row strong { color: #40596a; text-align: right; }
.profile-id { margin-top: 10px; color: #9aa6af; font: 10px 'DM Sans', sans-serif; overflow-wrap: anywhere; }
.logout-button { border-color: #d6655d; background: #d6655d; }
.logout-button:hover { background: #bb514b; }

@keyframes pulse { 50% { opacity: .45; } }
@keyframes rotate { to { transform: rotate(360deg); } }

@media (max-width: 1320px) {
  .app-shell { grid-template-columns: 60px 310px minmax(260px, 1fr) 320px; }
  .topbar { padding-right: 17px; gap: 17px; }
  .brand { width: 155px; }
}
@media (max-width: 1120px) {
  .app-shell { grid-template-columns: 58px 305px minmax(250px, 1fr); }
  .detail-panel { position: absolute; top: 88px; right: 14px; bottom: 14px; width: 330px; border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow); }
  .detail-panel:has(#detailEmpty:not([hidden])) { display: none; }
  .detail-panel:has(#detailContent:not([hidden])) { display: flex; }
  .api-status #apiStatusText { display: none; }
}
@media (max-width: 760px) {
  body { min-width: 360px; }
  .app-shell { grid-template-columns: 50px minmax(0, 1fr); grid-template-rows: 58px minmax(0,1fr); }
  .topbar { gap: 10px; padding: 0 10px; }
  .brand { width: auto; gap: 7px; }
  .brand-name { font-size: 16px; }
  .brand-mark { transform: scale(.82) skewY(-9deg); transform-origin: left center; width: 24px; }
  .topbar-divider { height: 27px; }
  .page-title .eyebrow { display: none; }
  .page-title strong { font-size: 13px; }
  .api-status { display: none; }
  .update-stamp { display: none; }
  .account-button { gap: 6px; padding-left: 7px; }
  .account-avatar { width: 29px; height: 29px; }
  .account-copy { min-width: 0; max-width: 96px; }
  .account-copy strong { max-width: 96px; font-size: 9px; }
  .account-copy small, .account-button > svg { display: none; }
  .navrail { grid-row: 2; padding-top: 10px; }
  .rail-button { width: 37px; height: 37px; }
  .rail-button svg { width: 18px; height: 18px; }
  .objects-panel { position: absolute; z-index: 280; top: 70px; left: 58px; bottom: 12px; width: min(310px, calc(100vw - 77px)); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); transform: translateX(calc(-100% - 20px)); transition: transform .22s ease; }
  .objects-panel.open { transform: translateX(0); }
  .objects-heading { padding: 15px 14px 12px; }
  .objects-heading h1 { font-size: 18px; }
  .search-box { margin: 0 10px 10px; }
  .filter-row { padding: 0 10px 11px; }
  .object-row { min-height: 61px; padding-left: 12px; }
  .map-area { grid-column: 2; grid-row: 2; }
  .map-topline { top: 10px; left: 9px; right: 9px; }
  .map-context { min-height: 35px; padding: 0 8px; gap: 7px; }
  .map-context strong { font-size: 9px; }
  .map-context { font-size: 8px; }
  .map-actions { gap: 0; }
  .map-action { min-height: 28px; padding: 0 6px; }
  .map-action span { display: none; }
  .map-action svg { width: 16px; height: 16px; }
  .map-legend { right: 8px; bottom: 11px; gap: 7px; padding: 7px; font-size: 8px; }
  .map-attribution-note { display: none; }
  .detail-panel { z-index: 320; top: auto; right: 7px; bottom: 8px; left: 58px; width: auto; max-height: min(76vh, 590px); border-radius: 13px; }
  .detail-panel:has(#detailContent:not([hidden])) { display: flex; }
  .detail-panel:has(#detailEmpty:not([hidden])) { display: none; }
  .detail-header { padding: 13px 14px 10px; }
  .detail-header h2 { font-size: 16px; }
  .detail-body { padding: 12px 14px 14px; }
  .detail-tabs { padding: 0 10px; }
  .detail-bottom { min-height: 40px; }
  .auth-card { padding: 27px 23px; border-radius: 16px; }
  .auth-brand { margin-bottom: 29px; }
}
