/* ui.js: search, quick add, phone navigation, Today layout, settings */

/* ---------- header: search trigger + settings ---------- */
.ui-search-trigger {
  display: inline-flex; align-items: center; gap: 10px; min-width: 260px; padding: 8px 12px; border-radius: 10px; cursor: pointer;
  background: rgba(10,18,30,0.75); border: 1px solid var(--panel-border); color: var(--muted); font: inherit; font-size: 13px; margin-right: -18px;
}
.ui-search-trigger:hover { border-color: rgba(52,237,243,0.5); color: var(--text); }
.ui-search-trigger > span:first-child { font-size: 18px; line-height: 1; color: var(--cyan); }
.ui-search-trigger kbd { margin-left: auto; font: 600 10px/1 ui-monospace, Menlo, monospace; padding: 4px 6px; border-radius: 5px; border: 1px solid var(--panel-border); color: var(--muted); }
.ui-gear { font-size: 16px; padding: 6px 10px; margin-right: -18px; }
@media (max-width: 1100px) { .ui-search-trigger { min-width: 0; } .ui-search-label, .ui-search-trigger kbd { display: none; } }

/* ---------- search palette ---------- */
.ui-palette-backdrop { position: fixed; inset: 0; z-index: 1000; background: rgba(2,6,12,0.72); backdrop-filter: blur(4px); display: flex; justify-content: center; align-items: flex-start; padding: 9vh 16px 16px; }
.ui-palette-backdrop[hidden] { display: none; }
.ui-palette { width: 100%; max-width: 660px; max-height: 78vh; display: flex; flex-direction: column; background: #0b111c; border: 1px solid rgba(52,237,243,0.35); border-radius: 14px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,0.6), 0 0 40px rgba(52,237,243,0.1); }
.ui-palette-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--panel-border); }
.ui-palette-input > span { font-size: 20px; color: var(--cyan); }
.ui-palette-input input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: var(--text); font: inherit; font-size: 16px; }
.ui-x { border: 1px solid var(--panel-border); background: transparent; color: var(--muted); border-radius: 6px; font: 600 11px/1 inherit; padding: 5px 7px; cursor: pointer; }
.ui-palette-results { overflow-y: auto; padding: 6px 8px 10px; }
.ui-group { padding: 6px 0; }
.ui-group-h { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); padding: 6px 10px; }
.ui-group-h span { color: var(--cyan); margin-left: 4px; }
.ui-row { display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; padding: 9px 10px; border-radius: 8px; border: 0; background: transparent; color: var(--text); font: inherit; cursor: pointer; }
.ui-row b { font-weight: 600; font-size: 14px; }
.ui-row span { font-size: 12px; color: var(--muted); }
.ui-row.sel, .ui-row:hover { background: rgba(52,237,243,0.1); }
.ui-more { border: 0; background: transparent; color: var(--cyan); font: inherit; font-size: 12px; padding: 4px 10px; cursor: pointer; }
.ui-palette-tip, .ui-palette-status, .ui-palette-empty { padding: 10px; color: var(--muted); font-size: 13px; }
.ui-palette-status { font-size: 12px; }
body.ui-noscroll { overflow: hidden; }

/* ---------- quick add ---------- */
#ui-quick-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 901; width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer;
  background: linear-gradient(135deg, #ffc670, #ff9e2c); color: #1a0f02; font: 800 30px/1 Inter, system-ui, sans-serif;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5), 0 0 22px rgba(255,158,44,0.35); transition: transform .15s;
}
#ui-quick-fab:hover { transform: translateY(-2px); }
#ui-quick-fab span { display: inline-block; transition: transform .2s; }
body.ui-quick-open #ui-quick-fab span { transform: rotate(45deg); }
#help-fab { bottom: 90px !important; width: 46px !important; height: 46px !important; right: 27px !important; font-size: 20px !important; }
#help-panel { bottom: 150px !important; }
.ui-quick { position: fixed; inset: 0; z-index: 900; background: rgba(2,6,12,0.45); }
.ui-quick[hidden] { display: none; }
.ui-quick-sheet { position: absolute; right: 22px; bottom: 90px; width: 330px; max-height: calc(100vh - 120px); overflow-y: auto; background: #0b111c; border: 1px solid rgba(255,158,44,0.35); border-radius: 14px; padding: 8px; box-shadow: 0 24px 60px rgba(0,0,0,0.6); animation: uiUp .16s ease-out; }
@keyframes uiUp { from { opacity: 0; transform: translateY(8px); } }
.ui-quick-h { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); padding: 8px 10px 4px; }
.ui-quick-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border: 0; border-radius: 9px; background: transparent; color: var(--text); text-align: left; font: inherit; cursor: pointer; }
.ui-quick-item:hover { background: rgba(255,158,44,0.1); }
.ui-quick-item small { display: block; color: var(--muted); font-size: 12px; }
.ui-qi { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--track); border: 1px solid var(--panel-border); font-size: 16px; flex: none; }

/* ---------- phone: bottom bar ---------- */
.ui-bar { display: none; }
@media (max-width: 700px) {
  .tabs-list { display: none !important; }
  .tabs { padding-bottom: 0 !important; }
  body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .ui-bar {
    display: grid; grid-template-columns: repeat(6, 1fr); align-items: center; position: fixed; left: 0; right: 0; bottom: 0; z-index: 902;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: rgba(6,10,18,0.96); backdrop-filter: blur(10px); border-top: 1px solid rgba(52,237,243,0.25);
  }
  .ui-bar-btn { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: transparent; color: var(--muted); font: 600 10px/1.2 Inter, system-ui, sans-serif; padding: 6px 0; cursor: pointer; }
  .ui-bar-ic { font-size: 18px; line-height: 1; }
  .ui-bar-btn.active { color: var(--cyan); }
  .ui-bar-add { justify-self: center; width: 48px; height: 48px; border-radius: 50%; border: 0; margin-top: -18px; background: linear-gradient(135deg, #ffc670, #ff9e2c); color: #1a0f02; font: 800 28px/1 Inter, system-ui, sans-serif; box-shadow: 0 6px 20px rgba(255,158,44,0.35); }
  .ui-bar-dot { position: absolute; top: 4px; right: 22%; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
  .ui-more-item .ui-bar-dot { right: 8px; top: 8px; }
  #ui-quick-fab, #help-fab { display: none !important; }
  #help-panel { bottom: 80px !important; }
  .ui-quick-sheet { left: 0; right: 0; bottom: 0; width: auto; max-height: 80vh; border-radius: 16px 16px 0 0; padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .ui-more-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 8px; }
  .ui-more-item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border: 0; border-radius: 10px; background: transparent; color: var(--text); font: 600 12px/1.2 Inter, system-ui, sans-serif; cursor: pointer; }
  .ui-more-item:active { background: rgba(52,237,243,0.1); }
  .ui-search-trigger { margin-right: 0; }
  .ui-gear { margin-right: 0; }
  .ui-palette-backdrop { padding: 0; }
  .ui-palette { max-width: none; max-height: 100%; height: 100%; border-radius: 0; border: 0; }
}

/* ---------- Today: layout ---------- */
.ui-today-tools { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin: -6px 0 8px; min-height: 20px; }
.ui-link { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.ui-link:hover { color: var(--cyan); }
.ui-hidden-note { font-size: 12px; color: var(--muted); }
#tab-today > [data-block] { position: relative; }
.ui-block-bar { position: absolute; top: 14px; right: 14px; z-index: 3; display: flex; align-items: center; gap: 8px; }
.ui-collapse { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--panel-border); background: rgba(10,18,30,0.8); color: var(--muted); cursor: pointer; font-size: 11px; line-height: 1; }
.ui-collapse:hover { color: var(--cyan); border-color: rgba(52,237,243,0.5); }
#tab-today > .ui-collapsed { padding-top: 12px !important; padding-bottom: 12px !important; }
#tab-today > .ui-collapsed > *:not(.ui-block-bar) { display: none !important; }
#tab-today > .ui-collapsed > .ui-block-bar { position: static; flex-direction: row; }
.ui-collapsed-title { border: 0; background: transparent; color: var(--muted); font: 700 12px/1 inherit; letter-spacing: 1.5px; text-transform: uppercase; cursor: pointer; padding: 0; }
.ui-collapsed-title:hover { color: var(--text); }
#tab-today > .ui-user-hidden { display: none !important; }
.ui-sales-block { padding: 2px 0; }
.ui-sales-block .ui-block-bar { top: 10px; right: 0; }
.ui-customizing > [data-block] { outline: 1px dashed rgba(52,237,243,0.45); outline-offset: 2px; }
.ui-customizing > [data-block].ui-user-hidden { display: block !important; opacity: 0.38; }
.ui-customizing > [data-block][hidden] { display: none !important; }
.ui-customizing > [data-block] > .ui-block-bar { position: static; justify-content: space-between; width: 100%; padding: 0 0 10px; margin-bottom: 10px; border-bottom: 1px solid var(--panel-border); }
.ui-block-name { font-weight: 700; color: var(--cyan); font-size: 13px; }
.ui-block-ctl { display: flex; gap: 6px; }
.ui-block-ctl button { border: 1px solid var(--panel-border); background: var(--track); color: var(--text); border-radius: 7px; padding: 5px 10px; font: inherit; font-size: 12px; cursor: pointer; }
.ui-block-ctl button:hover { border-color: var(--cyan); }
.ui-seeall { border: 0; background: transparent; color: var(--cyan); font: 600 12px/1 inherit; letter-spacing: 0; text-transform: none; cursor: pointer; margin-left: 10px; }
#tab-today .panel > h2 { padding-right: 40px; }

/* Pipeline buttons only show on Outreach. */
.pipeline-btn-group[hidden] { display: none !important; }

/* Phone header: keep everything within the screen width. */
@media (max-width: 700px) {
  .header-right { gap: 8px !important; flex-wrap: wrap; justify-content: flex-start; max-width: 100%; }
  .header-right > * { margin-right: 0 !important; }
  .header-right .btn.small { padding: 7px 10px; }
  .ui-search-trigger { padding: 7px 10px; }
  html, body { overflow-x: hidden; }
}


/* ---------- header layout: logo + title | search | who, settings, log out ---------- */
.header { align-items: center !important; flex-wrap: nowrap !important; gap: 24px !important; }
.header-brand { display: flex; align-items: center; gap: 18px; min-width: 0; flex: none; }
.header-brand #header-logo { width: 92px; height: 92px; }
.header-search { flex: 1; display: flex; justify-content: center; min-width: 0; }
.header-search .ui-search-trigger { width: 100%; max-width: 560px; min-width: 0; margin: 0; padding: 13px 18px; font-size: 14px; border-radius: 12px; }
.header-search .ui-search-trigger > span:first-child { font-size: 20px; }
.header-search .ui-search-label, .header-search .ui-search-trigger kbd { display: inline-block !important; }
.header-right { align-self: flex-start; gap: 10px !important; }
.header-right > * { margin-right: 0 !important; }
.header-right .signed-in-as { margin-right: 4px !important; text-transform: none; }

/* Refresh: alone at the right end of the tab bar, a different style from the tabs. */
.pipeline-btn-group { margin-left: auto; }
.tabs-refresh {
  margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(52,237,243,0.55); background: rgba(52,237,243,0.07); color: var(--cyan);
  font: 700 12px/1 Inter, system-ui, sans-serif; letter-spacing: 1.2px; text-transform: uppercase;
  box-shadow: inset 0 0 12px rgba(52,237,243,0.08); transition: background .15s, box-shadow .15s;
}
.tabs-refresh:hover { background: rgba(52,237,243,0.14); box-shadow: 0 0 16px rgba(52,237,243,0.3), inset 0 0 12px rgba(52,237,243,0.12); }
.pipeline-btn-group:not([hidden]) + .tabs-refresh { margin-left: 12px; }
.tabs-refresh.spinning { opacity: 0.75; cursor: progress; }

@media (max-width: 1000px) {
  .header { flex-wrap: wrap !important; }
  .header-search { order: 3; flex-basis: 100%; }
  .header-search .ui-search-trigger { max-width: none; }
  .header-right { margin-left: auto; }
}
@media (max-width: 700px) {
  .header-brand { gap: 12px; }
  .header-brand #header-logo { width: 56px; height: 56px; }
  .header-search .ui-search-trigger kbd { display: none !important; }
  /* Phone: tabs live in the bottom bar; the tab row keeps just Refresh (and the pipeline buttons on Outreach). */
  #dashboard > .tabs { border: 0 !important; background: transparent !important; padding: 0 !important; justify-content: flex-end; }
}
.header-brand > div:last-child { min-width: 0; }
@media (max-width: 700px) {
  .header-brand { flex: 1 1 100%; }
  .header-brand .subtitle { white-space: normal; overflow-wrap: anywhere; }
  .header-right { margin-left: auto; margin-top: -6px; }
  #dashboard > .tabs::before, #dashboard > .tabs::after { display: none !important; }
}

/* Search at the far right, just above the tab bar (wide screens). */
@media (min-width: 1001px) {
  .header { display: grid !important; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 24px; row-gap: 10px; align-items: stretch !important; margin-bottom: 14px !important; }
  .header-brand { grid-column: 1; grid-row: 1 / span 2; align-self: center; }
  .header-right { grid-column: 2; grid-row: 1; justify-self: end; align-self: start; }
  .header-search { grid-column: 2; grid-row: 2; justify-self: end; align-self: end; width: 100%; max-width: 480px; }
  .header-search .ui-search-trigger { max-width: none; }
  /* Breathing room around the logo: more space before the title and above the tabs. */
  .header { margin-bottom: 44px !important; padding-top: 8px; }
  .header-brand { gap: 44px; padding-left: 8px; }
}

/* ---------- Phone layout, matched to desktop ----------
   Top row: logo and title on the left, Log out in the top right.
   Search across the full width, then one line with Customize Today on the
   left and Refresh and Settings on the right. Bottom bar: Today, Clients,
   Proposals, centred +, Outreach, Calendar, More. */
.ui-mtools { display: none; }
@media (max-width: 700px) {
  .header { display: grid !important; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px !important; row-gap: 12px !important; align-items: center !important; margin-bottom: 10px !important; }
  .header-brand { grid-column: 1; grid-row: 1; flex: initial !important; gap: 30px !important; min-width: 0; padding-left: 8px; }
  .header-brand #header-logo { width: 54px !important; height: 54px !important; flex: none; }
  .header-brand .kicker { font-size: 9px; letter-spacing: 1.6px; margin-bottom: 2px; }
  .header-brand h1 { font-size: 18px; line-height: 1.15; margin: 0; }
  .header-brand .subtitle { font-size: 11px; white-space: nowrap !important; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
  .header-right { grid-column: 2; grid-row: 1; margin: 0 !important; align-self: start; flex-wrap: nowrap !important; gap: 6px !important; }
  .header-right .btn.small { height: 34px; padding: 0 11px !important; display: inline-flex; align-items: center; border-radius: 9px; font-size: 12px; }
  .header-search { grid-column: 1 / -1; grid-row: 2; order: initial !important; }
  .header-search .ui-search-trigger { padding: 11px 14px !important; font-size: 14px; }
  #dashboard > .tabs:not(:has(.pipeline-btn-group:not([hidden]))) { display: none !important; }

  .header-brand h1 span { display: block; white-space: nowrap; }
  .ui-mtools { grid-column: 1 / -1; grid-row: 2; display: flex; gap: 8px; margin: 10px 0 0; }
  .header-search { grid-row: 3 !important; }
  .ui-mtools > * { flex: 1 1 0; min-width: 0; height: 30px; margin: 0 !important; padding: 0 12px !important; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    border-radius: 8px; font: 700 12px/1 Inter, system-ui, sans-serif !important; letter-spacing: 0.2px; white-space: nowrap; text-transform: none; text-decoration: none; box-shadow: none; cursor: pointer; }
  .ui-mtools .tabs-refresh { border: 1px solid rgba(52,237,243,0.55); background: rgba(52,237,243,0.08); color: var(--cyan); }
  .ui-mtools .ui-gear, .ui-mtools #ui-customize-btn { border: 1px solid rgba(134,151,174,0.35); background: rgba(10,16,28,0.8); color: var(--text); }
  body:not([data-ui-section="today"]) .ui-mtools #ui-customize-btn { display: none; }
  .ui-today-tools { min-height: 0; margin: 0 0 4px; }
  .ui-today-tools:not(:has(.ui-hidden-note:not(:empty))) { display: none; }

  .ui-bar { grid-template-columns: repeat(7, 1fr); padding-left: 2px; padding-right: 2px; }
  .ui-bar-btn { font-size: 9.5px; letter-spacing: -0.1px; padding: 6px 0 4px; }
  .ui-bar-ic { font-size: 19px; height: 21px; display: flex; align-items: center; }
  .ui-bar-add { width: 52px; height: 52px; margin-top: -22px; font-size: 30px; border: 3px solid rgba(6,10,18,0.96); box-shadow: 0 6px 20px rgba(255,158,44,0.4); }
  .ui-bar-dot { right: 18%; }
}
@keyframes ui-spin { to { transform: rotate(360deg); } }

/* Phone: keep the header clear of the clock / notch (home-screen app draws
   under the status bar), cover the status bar area while scrolling, and leave
   room at the bottom so nothing hides behind the bottom bar. */
@media (max-width: 700px) {
  body { padding-top: calc(40px + env(safe-area-inset-top, 0px)) !important; padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px)) !important; }
  body::before { content: ''; position: fixed; top: 0; left: 0; right: 0; height: env(safe-area-inset-top, 0px); background: rgba(6,10,18,0.94); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); z-index: 950; pointer-events: none; }
}

/* Phones: keep overlays, pop-ups and the loading screen clear of the
   status bar / notch (deploy 75). */
@media (max-width: 700px) {
  #loading { padding-top: calc(70px + env(safe-area-inset-top, 0px)) !important; }
  .calendar-event-modal-backdrop, .modal-overlay, .ui-palette-backdrop {
    padding-top: calc(14px + env(safe-area-inset-top, 0px)) !important;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-sizing: border-box;
  }
  .calendar-event-modal, .modal-overlay > * {
    max-height: calc(100vh - 28px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
    max-height: calc(100dvh - 28px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
  }
  .cl-dialog {
    margin-top: calc(14px + env(safe-area-inset-top, 0px));
    max-height: calc(100dvh - 28px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
  }
  .soc-previews, .art-sticky { top: calc(12px + env(safe-area-inset-top, 0px)); }
  body::before { z-index: 1500; opacity: 1 !important; bottom: auto !important; }
}

/* Show day leave countdown (leave-countdown.js) */
#ui-leave-card { margin: 0 0 16px; display: grid; gap: 12px; }
.lc-card { border: 1px solid rgba(255,158,44,.45); border-radius: 16px; padding: 16px 18px; background: linear-gradient(160deg, rgba(255,158,44,.14), rgba(14,20,30,.9)); }
.lc-card.soon { border-color: rgba(255,158,44,.9); }
.lc-card.go { border-color: #ff5a4f; background: linear-gradient(160deg, rgba(255,90,79,.22), rgba(14,20,30,.9)); }
.lc-top { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.lc-kicker { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--accent-bright, #ffb547); font-weight: 700; }
.lc-top strong { font-size: 16px; }
.lc-big { font-size: 46px; font-weight: 800; line-height: 1.1; margin: 8px 0 2px; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.lc-card.go .lc-big { color: #ff7a70; }
.lc-label { font-size: 14px; color: var(--text, #e8edf5); }
.lc-meta { font-size: 13px; color: var(--muted, #9aa4b2); margin-top: 6px; }
.lc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* Outreach > Venues (venues.js) */
.vn-panel { margin-bottom: 16px; }
.vn-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.vn-head h2 { margin: 0 0 6px; }
.vn-form { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.vn-input { flex: 1 1 280px; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border, rgba(255,255,255,.14)); background: rgba(255,255,255,.04); color: var(--text); font: inherit; }
.vn-types { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 14px; }
.vn-types label { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.vn-pitch { margin-top: 12px; font-size: 14px; }
.vn-pitch summary { cursor: pointer; color: var(--muted); }
.vn-pitch textarea { width: 100%; margin: 8px 0; box-sizing: border-box; }
.vn-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.vn-list { display: grid; gap: 8px; margin-top: 10px; }
.vn-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; background: rgba(255,255,255,.02); cursor: pointer; }
.cf-list .vn-row { cursor: default; }
.vn-folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.vn-folder { display: flex; align-items: center; gap: 12px; text-align: left; padding: 14px; border: 1px solid rgba(255,255,255,.1); border-radius: 12px; background: rgba(255,255,255,.03); color: inherit; font: inherit; cursor: pointer; }
.vn-folder:hover, .vn-folder:focus-visible { border-color: rgba(245,166,35,.5); background: rgba(245,166,35,.06); }
.vn-folder-icon { font-size: 22px; line-height: 1; }
.vn-folder-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.vn-folder-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vn-folder-meta { font-size: 12px; }
.vn-folder-go { opacity: .5; font-size: 20px; }
.vn-crumb { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.vn-crumb h2 { margin: 0; }
.vn-map { height: 360px; border-radius: 12px; overflow: hidden; border: 1px solid rgba(255,255,255,.1); background: #11151c; }
.vn-radius { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-size: 13px; }
.vn-radius input[type=range] { flex: 1; max-width: 420px; accent-color: #f5a623; }
.vn-km-out { min-width: 56px; font-variant-numeric: tabular-nums; }
.vn-map-hint { font-size: 12px; margin: 8px 0 0; }
.vn-area-label { font-weight: 400; text-transform: none; letter-spacing: 0; }
.vn-pin { border-radius: 50%; box-shadow: 0 0 0 3px rgba(0,0,0,.45); }
.vn-pin-center { background: #f5a623; border: 3px solid #fff; cursor: move; }
.vn-pin-edge { background: #fff; border: 3px solid #f5a623; cursor: ew-resize; }
.vn-map .leaflet-tooltip { font-size: 12px; }
.vn-map .vn-tiles { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.85) saturate(.6); }
.vn-map .leaflet-control-attribution { background: rgba(10,14,20,.75); color: #9aa7b4; }
.vn-map .leaflet-control-attribution a { color: #f5a623; }
@media (max-width: 640px) { .vn-map { height: 280px; } }
.vn-collapse { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; text-align: left; }
.vn-collapse h2 { margin: 0; }
.vn-chev { display: inline-block; transition: transform .15s ease; opacity: .7; }
.vn-chev.closed { transform: rotate(-90deg); }
.vn-saved-row input[type=checkbox] { margin-top: 4px; width: 18px; height: 18px; flex: 0 0 auto; }
.vn-actions .vn-filter { width: auto; }
.cf-list { max-height: 640px; overflow-y: auto; }
.cf-contact { padding: 4px 8px; font-size: 13px; max-width: 100%; margin-left: 4px; }
.cf-toggle { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.vn-row input[type=checkbox] { margin-top: 4px; width: 18px; height: 18px; flex: 0 0 auto; }
.vn-saved { opacity: .7; }
.vn-saved-row { cursor: default; align-items: center; }
.vn-main { flex: 1; min-width: 0; }
.vn-name { font-weight: 600; }
.vn-meta { font-size: 13px; margin-top: 3px; overflow-wrap: anywhere; }
.vn-prog { font-size: 13px; margin-top: 6px; color: var(--accent-bright, #ffb547); }
.vn-prog.done { color: #6fd39a; }
.vn-prog.warn { color: #f0c26a; }
.vn-status { flex: 0 0 auto; max-width: 190px; }
.vn-filter { flex: 0 0 auto; max-width: 200px; }
.vn-error { margin: 0 0 16px; padding: 10px 14px; border-radius: 10px; background: rgba(240,180,60,.12); color: #f0c26a; }

/* ---------- in-app messages and questions (dialogs.js) ---------- */
.ui-toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px; z-index: 3000; display: flex; flex-direction: column; gap: 8px; width: min(520px, calc(100vw - 24px)); pointer-events: none; }
.ui-toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; background: #101a2b; border: 1px solid var(--panel-border); border-left: 3px solid var(--cyan); border-radius: 10px; padding: 12px 10px 12px 14px; color: var(--text); font-size: 14px; line-height: 1.4; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55); animation: ui-toast-in 0.2s ease-out; }
.ui-toast-bad { border-left-color: var(--bad); }
.ui-toast-good { border-left-color: var(--good); }
.ui-toast.out { opacity: 0; transform: translateY(6px); transition: opacity 0.2s, transform 0.2s; }
.ui-toast-text { flex: 1; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 40vh; overflow-y: auto; }
.ui-toast-x { flex: none; background: none; border: none; color: var(--muted); font-size: 20px; line-height: 1; padding: 2px 6px; cursor: pointer; border-radius: 6px; }
.ui-toast-x:hover { color: var(--text); }
@keyframes ui-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.ui-dialog-backdrop { position: fixed; inset: 0; z-index: 3100; background: rgba(2, 5, 10, 0.68); display: flex; align-items: center; justify-content: center; padding: 16px; }
.ui-dialog { width: 100%; max-width: 440px; background: #0e1420; border: 1px solid var(--panel-border); border-top: 3px solid var(--accent); border-radius: 14px; padding: 20px 18px 16px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6); }
.ui-dialog-msg { color: var(--text); font-size: 15px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 50vh; overflow-y: auto; }
.ui-dialog-input { width: 100%; margin-top: 14px; background: #0a101b; color: var(--text); border: 1px solid var(--panel-border); border-radius: 8px; padding: 10px 12px; font: inherit; font-size: 16px; }
textarea.ui-dialog-input { min-height: 96px; resize: vertical; }
.ui-dialog-input:focus { outline: 2px solid var(--cyan); outline-offset: 1px; }
.ui-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.ui-dialog-actions .btn { min-height: 40px; }
.ui-dialog-actions .btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.btn.ui-btn-danger { background: linear-gradient(135deg, #ff7a70 0%, var(--bad) 60%, #8e1a14 100%); color: #fff; }
@media (max-width: 700px) {
  .ui-toasts { bottom: calc(86px + env(safe-area-inset-bottom, 0px)); }
  .ui-dialog-backdrop { align-items: flex-end; padding: 0; }
  .ui-dialog { max-width: none; border-radius: 14px 14px 0 0; padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
  .ui-dialog-actions .btn { flex: 1; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { .ui-toast { animation: none; } }

/* ---------- compact phone header: small logo, one-line title, tools and search on one row ---------- */
@media (max-width: 700px) {
  .header { row-gap: 8px !important; margin-bottom: 8px !important; grid-template-columns: minmax(0, 1fr) auto !important; }
  .header-brand { gap: 24px !important; padding-left: 8px !important; }
  .header-brand #header-logo { width: 38px !important; height: 38px !important; }
  .header-brand .kicker { display: none; }
  .header-brand h1 { font-size: 16px !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .header-brand h1 span { display: inline !important; }
  .ui-mtools { grid-column: 1 !important; grid-row: 2 !important; margin: 0 !important; min-width: 0; }
  .ui-mtools > * { flex: 1 1 auto; min-width: 0; justify-content: center; }
  .header-search { grid-column: 2 !important; grid-row: 2 !important; width: auto !important; }
  .header-search .ui-search-trigger { width: 44px !important; min-width: 44px !important; max-width: 44px !important; height: 36px; padding: 0 !important; justify-content: center; border-radius: 9px; overflow: hidden; display: inline-flex !important; align-items: center; }
  .header-search .ui-search-trigger .ui-search-label, .header-search .ui-search-trigger kbd { display: none !important; }
}
.cf-undo, .vn-undo { background: none; border: 0; padding: 0; margin-left: 6px; font: inherit; color: #f5a623; text-decoration: underline; cursor: pointer; }
.vn-sent-on { font-size: 12px; white-space: nowrap; }

.cl-perf-add { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -2px 0 8px; }

.vn-filterbox { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.vn-filterbox .vn-input { flex: 1; max-width: 460px; }
.vn-filter-count { font-size: 13px; white-space: nowrap; }
.vn-row[hidden] { display: none !important; }
