/* Kastriva MerchantMap — enterprise workspace. No external font dependency. */
:root {
  color-scheme: dark;
  --bg: #101b2a; --bg2: #152232; --bg3: #101b2a;
  --card-solid: #182638; --card-a: #182638; --card-b: #182638;
  --field: #1d2e42; --field-2: #142132;
  --text: #e9eef5; --muted: #a5b3c5; --faint: #8e9fb4;
  --line: #2a3a4e; --line-strong: #4d657c;
  --accent: #12816f; --accent-2: #0c6c5d; --cyan: #70d9be;
  --ok: #75d9b6; --danger: #ff9eac;
  --shadow: 0 18px 48px #030b181c; --shadow-sm: 0 3px 12px #030b1812;
  --glass-hi: inset 0 1px 0 #ffffff03; --radius: 14px;
  --focus: 0 0 0 3px #3abfa350;
}
body.light {
  color-scheme: light;
  --bg: #f5f7fa; --bg2: #edf1f5; --bg3: #f5f7fa;
  --card-solid: #fff; --card-a: #fff; --card-b: #fff;
  --field: #fff; --field-2: #f8fafb;
  --text: #1c2a3c; --muted: #617083; --faint: #6a7b8d;
  --line: #e3e9ef; --line-strong: #b4c4d1;
  --accent: #117966; --accent-2: #0c6556; --cyan: #167865;
  --ok: #167865; --danger: #b63852;
  --shadow: 0 18px 48px #24364a0a; --shadow-sm: 0 3px 12px #24364a04;
  --glass-hi: inset 0 1px 0 #ffffff44;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-family: 'Inter', 'Segoe UI', system-ui, sans-serif; font-size: 14px; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: wait; opacity: .6; }
:is(button, a, input, select, textarea, [tabindex]):focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
::selection { background: #2fae9150; }
.ui-icon { width: 18px; height: 18px; flex: 0 0 auto; vertical-align: middle; }
.skip-link { position: fixed; top: -80px; left: 20px; z-index: 10000; padding: 14px; background: var(--card-solid); color: var(--text); }
.skip-link:focus { top: 12px; }
.glass { background: var(--card-solid); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.app-shell { padding-left: 248px; min-height: 100vh; }
main, footer { width: min(1300px, 100%); margin-inline: auto; padding-inline: 42px; }
.topbar { position: fixed; inset: 0 auto 0 0; width: 248px; z-index: 20; padding: 32px 20px 20px; display: flex; flex-direction: column; align-items: stretch; background: #112033; border: 0; border-right: 1px solid #2a394c; color: #e7edf5; box-shadow: none; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px; text-decoration: none; color: inherit; }
.brand img { width: 44px; height: 44px; border-radius: 12px; object-fit: contain; }
.brand strong { display: block; font-size: 22px; letter-spacing: -.6px; }
.brand small { display: block; margin-top: 3px; color: #9bacbf; font-size: 11px; letter-spacing: .7px; }
.nav-caption { margin: 48px 12px 14px; color: #90a2b9; font-size: 10px; font-weight: 600; letter-spacing: 1.8px; }
.main-nav { display: flex; flex-direction: column; gap: 7px; }
.nav-link { min-height: 48px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; color: #abbace; text-decoration: none; border-radius: 9px; font-size: 13px; font-weight: 500; border: 1px solid transparent; transition: background .18s; }
.nav-link:hover { background: #1d3045; color: #fff; }
.nav-link.active { background: #21443f; color: #9ce7d1; border-color: #31574d; }
.nav-arrow { margin-left: auto; opacity: 0; }
.nav-link.active .nav-arrow { opacity: 1; }
.sidebar-guide { margin: auto 2px 24px; padding: 20px 14px; border: 1px solid #2b3e52; border-radius: 12px; background: linear-gradient(135deg,#1b3441,#15273b); }
.sidebar-guide > .ui-icon { color: #7bdbc0; width: 24px; height: 24px; margin-bottom: 15px; }
.sidebar-guide strong { display: block; font-size: 12px; font-weight: 600; }
.sidebar-guide p { color: #a7b8ca; font-size: 11px; line-height: 1.8; margin: 8px 0 20px; }
.sidebar-guide > span { color: #8298b0; font-size: 10px; }
.top-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 18px; border-top: 1px solid #2a394c; }
.top-actions .connection { color: #a9b9cb; padding: 0 4px; font-size: 11px; font-weight: 500; }
.top-actions #connectionStatus { width: 100%; margin-bottom: 8px; }
.top-actions #userBadge { width: 100%; white-space: normal; overflow-wrap: anywhere; line-height: 1.6; }
.top-actions .connection.online { color: #7bdbc0; }
.top-actions .icon-btn { background: #1b2d42; border-color: #35485e; color: #dce5ee; }
#themeBtn { margin-left: auto; }
.workspace-context { height: 80px; display: flex; justify-content: space-between; align-items: center; gap: 14px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; margin-bottom: 30px; }
.workspace-context strong { color: var(--text); font-weight: 500; }
.context-divider { margin: 0 12px; color: var(--faint); }
.workspace-label { display: inline-flex; gap: 7px; align-items: center; font-size: 11px; }
.workspace-label .ui-icon { width: 14px; height: 14px; }
.hero { position: relative; overflow: hidden; isolation: isolate; padding: 32px 34px; border: 1px solid #314a54; border-radius: 16px; background: linear-gradient(115deg,#182b40,#16363c); color: #f5f8fa; margin-bottom: 24px; min-height: 246px; }
.hero > div:not(.hero-art) { position: relative; z-index: 1; max-width: 62%; }
.eyebrow { font-size: 10px; letter-spacing: 1.8px; color: var(--cyan); font-weight: 700; }
.hero .eyebrow { color: #a5cfca; }
.hero h1 { font-size: clamp(28px, 2.6vw, 38px); line-height: 1.2; letter-spacing: -1.2px; font-weight: 600; margin: 13px 0 12px; }
.hero h1 span { color: #86dbc5; }
.hero p { font-size: 13px; line-height: 1.8; color: #b2c6d1; max-width: 430px; margin: 0; }
.hero-art { position: absolute; width: 44%; right: -5px; top: 50%; transform: translateY(-50%); color: #b8d5d2; z-index: 0; }
.route-art { display: block; width: 100%; height: auto; }
.hero-actions { display: flex; gap: 10px; margin-top: 22px; }
.primary-btn, .secondary-btn, .small-btn, .ghost-btn, .note-cta-btn, .icon-btn, .close-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; padding: 0 15px; border: 1px solid var(--line); border-radius: 8px; background: var(--card-solid); color: var(--text); font-weight: 600; font-size: 12px; transition: background .18s, border-color .18s, box-shadow .18s; }
.primary-btn, .note-cta-btn { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 3px 5px #0000000a; }
.primary-btn:hover, .note-cta-btn:hover { background: var(--accent-2); border-color: var(--accent-2); }
.hero .primary-btn, .hero .note-cta-btn { background: #a2ead4; color: #153c33; border-color: #a2ead4; }
.hero .primary-btn:hover, .hero .note-cta-btn:hover { background: #c3f5e5; }
.secondary-btn:hover, .small-btn:hover, .icon-btn:hover, .ghost-btn:hover { background: var(--field-2); border-color: var(--line-strong); }
.ghost-btn { background: transparent; color: var(--muted); }
.danger { color: var(--danger); }
.stats-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin-bottom: 28px; }
.stat { display: flex; flex-direction: row-reverse; justify-content: space-between; align-items: center; gap: 10px; padding: 22px 20px; border-radius: 12px; }
.stat-icon { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 10px; display: grid; place-items: center; color: var(--cyan); background: color-mix(in srgb,var(--cyan) 10%,transparent); }
.stat:nth-child(2) .stat-icon { color: #799dde; background: #799dde16; }
.stat:nth-child(3) .stat-icon { color: #aa8ace; background: #aa8ace16; }
.stat:nth-child(4) .stat-icon { color: #bc9560; background: #bc956016; }
.stat > div:last-child { display: flex; flex-direction: column-reverse; gap: 9px; }
.stat strong { font-size: 28px; font-weight: 600; letter-spacing: -.7px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 11px; color: var(--muted); }
.workspace { min-width: 0; }
.toolbar { padding: 20px; border-radius: 12px; }
.toolbar-label { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 15px; font-size: 12px; }
.toolbar-label strong { font-weight: 600; }
.toolbar-label > span { color: var(--faint); font-size: 11px; }
.search-wrap { display: flex; align-items: center; gap: 10px; padding: 0 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--field-2); }
.search-wrap > span { display: inline-flex; color: var(--faint); }
.search-wrap:focus-within { border-color: var(--cyan); box-shadow: var(--focus); }
.search-wrap input { width: 100%; min-width: 0; height: 46px; border: 0; background: transparent; outline: none; color: var(--text); font-size: 12px; }
/* One focus indicator on the search wrapper, not a second box on the input. */
.search-wrap input:focus-visible { outline: none; box-shadow: none; }
/* The custom clear button already provides this action and an accessible label. */
.search-wrap input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
input::placeholder, textarea::placeholder { color: var(--faint); opacity: 1; }
.clear-search { border: 0; background: none; color: var(--muted); font-size: 22px; min-width: 32px; min-height: 40px; }
.filters { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; margin-top: 12px; }
.filters > * { width: 100%; min-width: 0; }
select, input, textarea { border: 1px solid var(--line); border-radius: 8px; background: var(--field-2); color: var(--text); }
.filters select { height: 42px; padding: 0 10px; font-size: 11px; text-overflow: ellipsis; }
select option { background: var(--card-solid); color: var(--text); }
.toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.toolbar-actions .secondary-btn { min-height: 36px; font-size: 11px; }
#nearbyBtn { margin-right: auto; color: var(--cyan); }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 28px 0 16px; }
.section-heading > div:first-child { display: flex; align-items: center; gap: 12px; }
.section-heading h2 { margin: 0; font-size: 17px; letter-spacing: -.4px; font-weight: 600; }
.section-heading span { color: var(--muted); font-size: 10px; background: var(--field-2); border: 1px solid var(--line); border-radius: 6px; padding: 4px 7px; }
.merchant-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.merchant-card { display: flex; flex-direction: column; min-width: 0; padding: 22px; border-radius: 12px; overflow: hidden; transition: border-color .18s, box-shadow .18s; }
.merchant-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card-head > div:first-child { min-width: 0; }
.merchant-title { font-size: 16px; margin: 0 0 7px; font-weight: 600; letter-spacing: -.3px; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 11px; margin: 10px 0; overflow-wrap: anywhere; }
.badge { display: inline-flex; gap: 5px; padding: 5px 8px; border-radius: 6px; border: 1px solid var(--line); font-size: 9px; color: var(--muted); }
.badge.area { color: var(--cyan); border-color: color-mix(in srgb,var(--cyan) 20%,var(--line)); background: color-mix(in srgb,var(--cyan) 7%,transparent); white-space: nowrap; }
.card-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; max-width: 46%; }
.distance-badge { color: var(--ok); }
.address-line { font-size: 12px; line-height: 1.7; padding: 12px; border-radius: 8px; background: var(--field-2); margin: 9px 0 3px; overflow-wrap: anywhere; }
.coordinates { font-family: ui-monospace,monospace; font-size: 10px; color: var(--faint); }
.note { font-size: 12px; line-height: 1.7; color: var(--muted); margin: 5px 0 18px; overflow-wrap: anywhere; }
.card-actions { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 8px; margin-top: auto; padding-top: 15px; border-top: 1px solid var(--line); }
.work-status-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 18px; }
.work-status-toolbar select { min-height: 42px; padding: 0 12px; font-size: 12px; }
#completionSummary { margin-left: auto; color: var(--muted); font-size: 12px; }
#completionStorageHint { flex-basis: 100%; margin: 0; }
.completion-control { display: flex; align-items: center; gap: 10px; padding: 12px 0; margin-top: auto; color: var(--muted); font-size: 12px; cursor: pointer; }
.completion-control input { flex: 0 0 18px; width: 18px; height: 18px; margin: 0; padding: 0; accent-color: var(--accent); }
.merchant-card.is-completed { border-color: var(--cyan); }
.merchant-card.is-completed .completion-control { color: var(--cyan); }
.completion-control + .card-actions { margin-top: 0; }
.photo-drop.busy { opacity: .7; }
.card-actions button { min-width: 0; padding-inline: 8px; font-size: 11px; white-space: normal; }
.card-actions .primary-btn { color: var(--cyan); background: color-mix(in srgb,var(--cyan) 8%,var(--card-solid)); border-color: color-mix(in srgb,var(--cyan) 22%,var(--line)); box-shadow: none; }
.card-thumb { position: relative; height: 170px; margin: -22px -22px 20px; cursor: zoom-in; overflow: hidden; }
.card-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.thumb-count { position: absolute; right: 10px; bottom: 10px; padding: 5px 9px; color: #fff; background: #112033bb; border-radius: 6px; font-size: 10px; }
.empty-state { text-align: center; padding: 42px 20px; border-radius: 12px; }
.empty-icon { width: 56px; height: 56px; display: grid; place-items: center; margin: auto; background: color-mix(in srgb,var(--cyan) 9%,transparent); color: var(--cyan); font-size: 28px; border-radius: 14px; }
.empty-state h3 { margin: 16px 0 8px; font-size: 16px; }
.empty-state p { color: var(--muted); font-size: 12px; line-height: 1.7; margin: 0 0 20px; }
.empty-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
footer { display: flex; justify-content: space-between; gap: 8px; color: var(--faint); font-size: 10px; padding-top: 30px; padding-bottom: 28px; }

/* ---------- modals ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 62%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: grid; place-items: center; padding: 16px; overflow: auto;
}
.modal { width: min(700px, 100%); border-radius: 24px; padding: 22px; max-height: 94vh; overflow: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.modal-head h2 { margin: 5px 0 0; letter-spacing: -.5px; }
.close-btn { font-size: 25px; width: 42px; padding: 0; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
label { color: var(--muted); font-size: 11px; font-weight: 600; }
label input, label select, label textarea {
  display: block; width: 100%; margin-top: 6px; padding: 11px 12px; color: var(--text);
}
label input, label select { height: 45px; }
label textarea { resize: vertical; }
.full { grid-column: 1 / -1; }

.coordinate-box { padding: 13px; border: 1px solid var(--line); border-radius: 15px; background: var(--field-2); }
.coordinate-head { display: flex; justify-content: space-between; align-items: center; color: var(--text); font-size: 12px; font-weight: 700; gap: 8px; }
.coord-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 9px; }
.hint { color: var(--muted); font-size: 10px; margin: 8px 0 0; line-height: 1.5; }
.small-btn { min-height: 34px; padding: 0 10px; font-size: 10px; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; }

/* ---------- photo uploader ---------- */
.photo-box { padding: 13px; border: 1px solid var(--line); border-radius: 15px; background: var(--field-2); }
.photo-count { color: var(--muted); font-size: 11px; font-weight: 700; }
.photo-drop {
  margin-top: 10px; border: 1.5px dashed var(--line-strong); border-radius: 14px;
  padding: 22px 14px; text-align: center; cursor: pointer; transition: .18s ease;
  background: color-mix(in srgb, var(--accent) 4%, transparent);
}
.photo-drop:hover, .photo-drop:focus-visible, .photo-drop.dragover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.photo-drop.busy { pointer-events: none; opacity: .6; }
.photo-drop-icon { display: block; font-size: 24px; color: var(--cyan); margin-bottom: 6px; }
.photo-drop strong { display: block; font-size: 12px; }
.photo-drop small { display: block; color: var(--muted); font-size: 10px; margin-top: 4px; }
.photo-camera-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.photo-camera-actions button { width: 100%; min-width: 0; }
.photo-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.photo-thumb {
  position: relative; width: 88px; height: 88px; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--line-strong); box-shadow: var(--shadow-sm);
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-remove {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 8px;
  border: 1px solid rgba(255, 120, 150, .45); background: rgba(30, 5, 15, .65); color: #ffd7de;
  font-size: 12px; line-height: 1; display: grid; place-items: center;
}
body.light .photo-remove { background: rgba(255, 235, 240, .9); color: #c22747; }
.photo-remove:hover { filter: brightness(1.15); }

/* ---------- hero actions: tambah merchant + tambah note ---------- */
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.note-cta-btn {
  border: 1px solid color-mix(in srgb, var(--ok) 40%, transparent);
  background: color-mix(in srgb, var(--ok) 10%, transparent);
  color: var(--ok);
  border-radius: 14px; min-height: 44px; padding: 0 16px;
  font-weight: 700; transition: .18s ease; white-space: nowrap;
}
.note-cta-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.notes-heading-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.notes-heading-actions .ghost-btn { min-height: 36px; padding: 0 10px; font-size: 10px; }
.sticky-title { margin: 0; font-size: 14px; line-height: 1.3; letter-spacing: -.2px; color: var(--text); }

/* ---------- sticky notes board (halaman penuh di notes.html) ---------- */
.notes-board {
  margin-top: 0;
  min-width: 0;
}
.notes-board .section-heading { margin-top: 0; }
.notes-toolbar { padding: 12px 14px; border-radius: 16px; }
.notes-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px; margin-top: 14px;
}
.sticky-note {
  --tilt: 0deg;
  position: relative;
  background: linear-gradient(145deg, color-mix(in srgb, var(--ok) 13%, var(--card-solid)), color-mix(in srgb, var(--accent) 7%, var(--card-solid)));
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--ok) 24%, var(--line));
  border-radius: 15px;
  padding: 22px 14px 12px;
  min-height: 140px;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 14px 32px rgba(1, 8, 18, .18), var(--glass-hi);
  transform: rotate(var(--tilt));
  transition: .2s ease;
  overflow-wrap: anywhere;
  backdrop-filter: blur(18px) saturate(135%);
  -webkit-backdrop-filter: blur(18px) saturate(135%);
}
.sticky-note:hover { transform: rotate(0deg) translateY(-3px); box-shadow: 0 20px 42px rgba(60, 40, 0, .3); }
.note-tape {
  position: absolute; top: -9px; left: 50%; transform: translateX(-50%) rotate(-2deg);
  width: 74px; height: 20px;
  background: rgba(255, 255, 255, .42);
  border: 1px solid rgba(255, 255, 255, .5);
  box-shadow: 0 3px 8px rgba(60, 40, 0, .14);
  border-radius: 2px;
  backdrop-filter: blur(3px);
}
.sticky-text { margin: 0; font-size: 13px; line-height: 1.6; color: var(--text); white-space: pre-wrap; }
.sticky-note:not(.is-expanded) .sticky-text.is-collapsible {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 7;
  overflow: hidden;
  max-height: 11.2em;
}
.sticky-note.is-expanded .sticky-text.is-collapsible { display: block; max-height: none; overflow: visible; }
.note-expand-btn {
  align-self: flex-start;
  min-height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 700;
}
.note-expand-btn:hover { text-decoration: underline; }

.sticky-foot {
  margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  color: var(--muted); font-size: 10px; font-weight: 700;
}
.sticky-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; flex: 0 0 auto; }
.sticky-date { min-width: 0; flex: 1 1 auto; }
.copy-note-btn { width: auto !important; min-width: 36px; padding: 0 9px; gap: 5px; }
.copy-note-label { display: none; font-size: 10px; font-weight: 700; }
.sticky-btn {
  width: 28px; height: 28px; border-radius: 8px; font-size: 13px; line-height: 1;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--ok) 8%, transparent); color: var(--text);
  display: grid; place-items: center;
}
.sticky-btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.sticky-btn:hover { filter: brightness(1.08); background: var(--field); }
.notes-empty { color: var(--muted); font-size: 12px; padding: 4px 2px 10px; }
.notes-empty strong { color: var(--text); }

/* ---------- note modal ---------- */
.note-modal { width: min(520px, 100%); }
.note-modal textarea { width: 100%; padding: 11px 12px; resize: vertical; }

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center;
  background: rgba(2, 6, 18, .88); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.lightbox.hidden { display: none; }
.lightbox img {
  max-width: min(92vw, 1100px); max-height: 82vh; border-radius: 16px;
  border: 1px solid rgba(140, 180, 255, .22); box-shadow: 0 30px 90px rgba(0, 0, 0, .6);
  object-fit: contain;
}
.lb-btn {
  position: absolute; z-index: 2; width: 46px; height: 46px; border-radius: 14px; font-size: 26px;
  border: 1px solid rgba(140, 180, 255, .28); background: rgba(10, 20, 46, .66); color: #eaf2ff;
  display: grid; place-items: center; backdrop-filter: blur(8px);
}
.lb-btn:hover { background: rgba(28, 48, 100, .8); }
.lb-close { top: 18px; right: 18px; }
.lb-close > span { display: none; }
#lbPrev { left: 14px; top: 50%; transform: translateY(-50%); }
#lbNext { right: 14px; top: 50%; transform: translateY(-50%); }
.lb-counter {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  color: #d7e4ff; font-size: 12px; font-weight: 700; letter-spacing: 1px;
  background: rgba(10, 20, 46, .6); border: 1px solid rgba(140, 180, 255, .25);
  border-radius: 999px; padding: 6px 14px; backdrop-filter: blur(8px);
}

/* ---------- toast ---------- */
.toast {
  position: fixed; z-index: 400; left: 50%; bottom: 25px; transform: translate(-50%, 20px);
  opacity: 0; pointer-events: none;
  background: var(--card-solid); border: 1px solid var(--line-strong); color: var(--text);
  padding: 12px 17px; border-radius: 13px; font-size: 12px; font-weight: 600;
  box-shadow: var(--shadow); transition: .25s; max-width: min(92vw, 560px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.hidden { display: none !important; }

/* ---------- connection / auth ui ---------- */
.connection { font-size: 10px; font-weight: 800; color: var(--muted); padding: 0 5px; white-space: nowrap; }
.connection.online { color: var(--ok); }
.login-modal { max-width: 460px; }
.auth-links { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; }
.link-btn { border: 0; background: none; color: var(--cyan); font-size: 11px; font-weight: 700; padding: 4px 0; }
.link-btn:hover { text-decoration: underline; }
.requires-auth { position: relative; }


/* Shared controls, notes and authentication */
.modal { border-radius: 16px; padding: 28px; }
.modal-head h2 { font-size: 23px; }
.modal-backdrop { background: #081321a6; }
label { font-size: 12px; }
label input, label textarea, label select { font-size: 14px; }
.hint { font-size: 11px; line-height: 1.7; }
.close-btn { font-size: 24px; }
.note-cta-btn { background: var(--accent); color: #fff; border-radius: 8px; }
.notes-toolbar { padding: 16px; border-radius: 12px; }
.notes-grid { grid-template-columns: repeat(auto-fill,minmax(240px,1fr)); gap: 16px; margin-top: 20px; }
.sticky-note { background: var(--card-solid); border: 1px solid var(--line); border-top: 3px solid var(--cyan); border-radius: 10px; padding: 22px 20px 16px; min-height: 200px; box-shadow: var(--shadow-sm); transform: none; backdrop-filter: none; }
.sticky-note:nth-child(3n+2) { border-top-color: #c6a16b; }
.sticky-note:nth-child(3n+3) { border-top-color: #9c90c5; }
.sticky-note:hover { transform: none; box-shadow: var(--shadow); }
.note-tape { display: none; }
.sticky-title { font-size: 15px; font-weight: 600; }
.sticky-text { color: var(--muted); font-size: 13px; }
.sticky-foot { border-top: 1px solid var(--line); padding-top: 12px; }
.sticky-btn { width: 36px; height: 36px; background: var(--field-2); }
.toast { z-index: 10001; }
.top-actions .icon-btn:hover { background: #2b425a; border-color: #55718b; color: #fff; }
body.auth-locked > .app-shell { display: none; }
body.auth-locked #loginBackdrop { display: grid !important; }
body.auth-locked #closeLogin, body.auth-locked #cancelLogin { display: none; }
.auth-page { position: fixed; inset: 0; z-index: 9999; display: grid; grid-template-columns: minmax(0,1.1fr) minmax(0,1fr); align-items: center; gap: 8vw; padding: 56px max(5vw,24px); background: var(--bg); overflow-y: auto; }
.auth-page::before { content: ''; position: fixed; inset: 0 50% 0 0; background: linear-gradient(145deg,#102134,#193e43); pointer-events: none; }
.auth-landing { position: relative; color: #eef5f8; width: 100%; max-width: 600px; justify-self: center; }
.auth-brand-lockup { display: flex; align-items: center; gap: 12px; margin-bottom: 54px; }
.auth-brand-logo { width: 48px; height: 48px; object-fit: contain; }
.auth-brand-lockup .eyebrow { color: #bcdbd9; letter-spacing: 1.7px; }
.auth-landing h1 { font-size: clamp(36px,4vw,60px); line-height: 1.13; letter-spacing: -2px; font-weight: 600; margin: 0 0 22px; }
.auth-landing h1 span { color: #86ddc3; }
.auth-lead { color: #b2c8d2; max-width: 430px; font-size: 15px; line-height: 1.85; margin: 0; }
.auth-map { max-width: 430px; color: #abc8ca; margin-top: 20px; }
.auth-highlights { display: flex; flex-wrap: wrap; gap: 18px; padding-top: 20px; border-top: 1px solid #38535e; font-size: 10px; color: #b9d1d8; }
.auth-highlights > span { display: flex; align-items: center; gap: 6px; }
.auth-highlights .ui-icon { width: 14px; height: 14px; }
.auth-page .login-modal { position: relative; width: 100%; max-width: 440px; max-height: none; justify-self: center; padding: 36px; border-radius: 16px; box-shadow: var(--shadow); }
.auth-page .modal-head { margin-bottom: 18px; }
.auth-page .modal-head h2 { margin-top: 12px; font-size: 30px; font-weight: 600; letter-spacing: -1px; }
.login-intro { font-size: 13px; line-height: 1.8; color: var(--muted); margin: 0 0 28px; }
.auth-page input { height: 48px; font-size: 14px; }
.auth-page .form-actions { display: flex; margin-top: 24px; }
.auth-page .form-actions button { flex: 1; min-height: 46px; }
.auth-links { margin-top: 18px; }
.auth-links .link-btn { min-height: 36px; font-size: 12px; }
.auth-page .hint { margin-top: 18px; }
.auth-page .close-btn { flex: 0 0 36px; }
@media (min-width: 1600px) { .merchant-list { grid-template-columns: repeat(3,minmax(0,1fr)); } }
@media (max-width: 1150px) {
  .app-shell { padding-left: 216px; } .topbar { width: 216px; padding-inline: 14px; }
  main, footer { padding-inline: 26px; }
  .stat { padding: 18px 14px; } .stat-icon { width: 32px; height: 32px; }
  .card-head { flex-wrap: wrap; } .card-badges { max-width: 100%; }
}
@media (max-width: 900px) {
  .app-shell { padding-left: 0; }
  .topbar { position: sticky; top: 0; width: 100%; padding: 12px 20px; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 10px; }
  .brand { padding: 0; } .brand img { width: 36px; height: 36px; } .brand strong { font-size: 18px; } .brand small { font-size: 10px; }
  .nav-caption, .sidebar-guide { display: none; }
  .main-nav { flex-direction: row; margin-left: auto; }
  .nav-link { min-height: 42px; padding: 8px 12px; } .nav-arrow { display: none; }
  .top-actions { padding: 0; border: 0; flex-wrap: nowrap; } .top-actions .connection { display: none; }
  .top-actions .icon-btn { min-height: 38px; padding-inline: 10px; }
  .workspace-context { height: 66px; margin-bottom: 22px; }
  .auth-page { gap: 5vw; padding-inline: 30px; }
  .auth-page .login-modal { padding: 26px; }
  .auth-highlights { gap: 12px; } .auth-brand-lockup .eyebrow { font-size: 8px; }
}
@media (max-width: 700px) {
  .sticky-foot { flex-wrap: wrap; align-items: center; row-gap: 10px; }
  .sticky-date { flex: 1 1 130px; }
  .sticky-actions { margin-left: auto; }
  .copy-note-btn { min-width: 72px; height: 40px; padding-inline: 10px; }
  .copy-note-label { display: inline; }
  .topbar { padding: 12px; row-gap: 12px; } .brand { order: 1; } .top-actions { order: 2; margin-left: auto; }
  .main-nav { order: 3; width: 100%; margin: 0; gap: 8px; } .nav-link { flex: 1; justify-content: center; }
  main, footer { padding-inline: 18px; } .workspace-label { display: none; }
  .hero { padding: 26px; } .hero > div:not(.hero-art) { max-width: 82%; }
  .hero-art { width: 60%; right: -90px; opacity: .35; }
  .hero h1 { font-size: 32px; } .hero p { font-size: 12px; }
  .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-bottom: 20px; }
  .stat { padding: 18px 16px; } .stat strong { font-size: 26px; }
  .filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .merchant-list { grid-template-columns: 1fr; }
  .toolbar { padding: 16px; } .toolbar-label > span { display: none; }
  #nearbyBtn { margin-right: 0; } .toolbar-actions .secondary-btn { flex: 1 1 auto; min-height: 40px; }
  .section-heading h2 { font-size: 16px; } .section-heading > div:first-child { gap: 8px; }
  .notes-grid { grid-template-columns: 1fr; }
  .auth-page { position: absolute; bottom: auto; min-height: 100dvh; height: auto; grid-template-columns: 1fr; padding: 28px 20px 40px; gap: 26px; overflow: visible; }
  .auth-page::before { position: absolute; inset: 0 0 auto; height: 290px; }
  .auth-landing { max-width: 440px; } .auth-brand-lockup { margin-bottom: 26px; }
  .auth-brand-lockup .eyebrow { font-size: 10px; } .auth-brand-logo { width: 36px; height: 36px; }
  .auth-landing h1 { font-size: 34px; letter-spacing: -1px; margin-bottom: 12px; }
  .auth-lead { font-size: 12px; line-height: 1.7; max-width: 360px; }
  .auth-map, .auth-highlights { display: none; }
  .auth-page .login-modal { padding: 28px; }
  body.auth-locked { overflow-y: auto !important; }
}
@media (max-width: 480px) {
  .hero { padding: 24px; } .hero > div:not(.hero-art) { max-width: 100%; } .hero-art { opacity: .15; }
  .hero-actions .primary-btn, .hero-actions .note-cta-btn { width: 100%; }
  .hero h1 { font-size: 30px; } .eyebrow { font-size: 9px; }
  .stat span { font-size: 10px; } .stat-icon { width: 30px; height: 30px; }
  .form-grid, .coord-grid { grid-template-columns: 1fr; } .full { grid-column: auto; }
  .modal { padding: 20px; max-height: 90dvh; } .modal-backdrop { padding: 12px; }
  .coordinate-head { flex-wrap: wrap; } .photo-camera-actions { grid-template-columns: 1fr; }
  .section-heading { flex-wrap: wrap; } .notes-heading-actions { width: 100%; justify-content: flex-start; }
  .notes-heading-actions .ghost-btn { min-height: 42px; }
  .merchant-card { padding: 18px; } .card-thumb { margin: -18px -18px 18px; }
  footer { flex-direction: column; }
  label input, label textarea, label select, .auth-page input { font-size: 16px; }
  .auth-page { padding: 24px 16px 32px; } .auth-page .login-modal { padding: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; }
}
