/* Desktop layout only. Phone styles are unchanged below 900px. */
@media (min-width: 900px) {
  html, body {
    overflow: hidden;
    height: 100%;
  }

  .phone {
    width: 100%;
    max-width: 1480px;
    height: 100dvh;
    margin: 0 auto;
  }
  #app.wk-wide,
  #app.desk {
    max-width: 1480px;
  }

  /* Shared chrome */
  .phone.desk .top { padding-left: 20px; padding-right: 20px; }
  .phone.desk .scroll { padding-left: 20px; padding-right: 20px; }
  .phone.desk .seg.fu-sub { margin-left: 20px; margin-right: 20px; }
  .phone.desk nav.fu-main,
  .phone.desk nav.tabs { padding-left: 20px; padding-right: 20px; }

  /* Today: route list | map */
  .tc-scroll.has-map {
    display: grid;
    grid-template-columns: minmax(360px, 440px) minmax(0, 1fr);
    gap: 16px;
    align-items: stretch;
    overflow: hidden;
    min-height: 0;
    flex: 1;
    padding: 4px 20px 16px;
  }
  .tc-scroll.has-map .tc-list {
    overflow-y: auto;
    min-height: 0;
    padding-right: 4px;
  }
  .tc-scroll.has-map .tc-map {
    grid-column: 2;
    grid-row: 1;
    height: auto !important;
    min-height: 0;
    margin: 0;
    align-self: stretch;
  }
  .tc-scroll.has-map .tc-list {
    grid-column: 1;
    grid-row: 1;
  }

  /* Dispatch: Needs + Week/Month side by side */
  .desk-dispatch {
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    gap: 16px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 0 16px 8px;
  }
  .desk-needs,
  .desk-cal {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
  }
  .desk-needs .scroll,
  .desk-cal .scroll {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding-left: 8px;
    padding-right: 8px;
  }
  .desk-needs .top .brand-row { display: none; }
  .desk-needs .top { padding: 2px 8px 8px; }
  .desk-cal .top { padding-left: 8px; padding-right: 8px; }
  .desk-needs .title { font-size: 20px; }
  .desk-dispatch > .seg.fu-sub {
    grid-column: 1 / -1;
    margin: 10px 0 6px;
    max-width: none;
  }
  .desk-needs .signout { display: none; }
  .desk-dispatch .wk-scroll { padding-left: 8px; padding-right: 8px; }
  #app.desk .wk-grid,
  #app.desk.wk-wide .wk-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; align-items: start; }
  #app.desk .wk-col,
  #app.desk.wk-wide .wk-col { min-height: 180px; padding: 4px 6px 8px; background: var(--bg3); border-radius: 14px; }
  #app.desk .wk-still-row { flex-direction: row; flex-wrap: wrap; }
  #app.desk .wk-still-row .wk-card { width: 240px; }
  .desk-cal .month-cal { max-width: none; }

  /* Leads / Follow-up / Reports: card grid */
  .fu-scroll {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 12px;
    align-content: start;
    padding: 4px 20px 24px;
  }
  .fu-scroll > .fu-card { margin-bottom: 0; }
  .fu-scroll > .fu-sum,
  .fu-scroll > .fu-h,
  .fu-scroll > .fu-warn,
  .fu-scroll > .empty,
  .fu-scroll > .fu-empty,
  .fu-scroll > .fu-link,
  .fu-scroll > .fu-center,
  .fu-scroll > .fu-addbtn,
  .fu-scroll > .fu-form,
  .fu-scroll > .fu-set,
  .fu-scroll > .fu-mut.fu-center {
    grid-column: 1 / -1;
  }

  /* Sheets: side panel instead of a full-width drawer */
  .dim { position: absolute; }
  .sheet {
    left: auto;
    right: 20px;
    top: 16px;
    bottom: 16px;
    width: min(440px, calc(100% - 40px));
    max-width: 440px;
    border-radius: 18px;
    overflow: auto;
    padding-bottom: 20px;
  }

  /* Login stays a readable column */
  .login { max-width: 420px; margin: 0 auto; }

  /* Sync "Updated" note */
  .sync-note {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 10px;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--ok-soft);
    color: var(--ok);
    font-family: Geist, sans-serif;
    font-size: 11.5px;
    font-weight: 700;
    border: 0;
    cursor: pointer;
    vertical-align: middle;
  }
}

/* The note is also useful on phone if a form is open during a sync */
.sync-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--ok-soft, #d8efe0);
  color: var(--ok, #1b6b3a);
  font-family: Geist, sans-serif;
  font-size: 11.5px;
  font-weight: 700;
  border: 0;
  cursor: pointer;
}
.sync-note[hidden], .sync-note.is-off { display: none; }

.sync-note-float {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
  margin-left: 0;
}
